Nemo's bash challenge for the day

Nemo - earth native nemo at cheeky.house.cx
Sat Mar 30 11:21:04 EST 2002


On Sat, Mar 30, 2002 at 08:35:35AM +1100, Michael Still did utter:
> 
> ls -l $1 | tr -s " " | sed 's/^.*[0-9] //' | sed 's/^.*-> //'
> 
> (This can probably be optimized more, as this is going to invoke a quite
> silly number of proceses -- 4 in this case... Also why do you care about
> symlinks? If you just use them, then you'll end up in the right place
> anyway).

For my uses, knowing the symlink name is knowing the theme name.
All the scripts just use "theme_0" as the themename... theme_0 is a
symlink to the theme's directory... it's the *only* place that knows
about this. Knowing the themename can be kinda usefull I figure - for
screenshots and xmessage's :)

It occured to me thismorning, however, that since theme_0 should be a
symlink to a *directory* only, and not a file, then I can do this:

#!/bin/sh
cd $1
basename `/bin/pwd`
cd -

`cd` handles all the recursion I need to worry about :)
(a couple of error handling checks in case $1 isn't a directory
afterall, and I'm all happy :)

btw, mikal... that weighted random script... scares me :)

.../Nemo

.sig on diet. do not feed bad bytes.




More information about the linux mailing list