[TxMt] tmTheme: Slate

Allan Odgaard throw-away-1 at macromates.com
Thu Nov 10 16:16:33 UTC 2005


On 10/11/2005, at 16.22, Andreas Wahlin wrote:

> [...] what was described was a way of having a toggle between two  
> files, but i want a toggel between n files.

The stuff I showed used a bash array, so just do:

themes=(theme1 theme2 theme3)

You'll have to use modulo “number of themes”, which was the “total”  
variable in my last script.

So just making it:

>> themes=(theme1 theme2 theme3)
>> rand=$(dd </dev/random bs=1 count=1 2>/dev/null|hexdump -e '/1 "%u"')
>> total=${#themes[@]}
>> open "${themes[$((rand % total))]}"

Should work. Though remeber to quote theme paths properly, though ~  
won't expand in double quotes, so use $HOME instead.




More information about the textmate mailing list