On Sun, Nov 02, 2003 at 03:50:25AM -0500, Behdad Esfahbod wrote: > > APP=`which app` > > DIR=`dirname $APP` > > cd $DIR && echo $DIR && $APP > > Unfortunately fails almost all the time, unless APP is something > like X or Java or some huge other thing that has its own share in > $PATH.
Huh? if app is a standalone executable, it works. If app needs an interpreter to run (i.e. 'java foo' or '/bin/bash myscript'), you will need to adapt the snippet above to it. >Otherwise, perhaps you are trying a symlink is a public > bin directory (/usr/bin) which points to your own bin > (/usr/MyApp/bin). I probably would suggest (and actually use) > this one: > > APP="myApp" > BASEAPP=`\which "$APP" 2>/dev/null` people who alias 'which' to something else deserve what they get ;-) > BASEAPP=`readlink -f "$APP"` interesing twist, but I'm not sure it's necessary. Cheers, Muli -- Muli Ben-Yehuda http://www.mulix.org | http://www.livejournal.com/~mulix "the nucleus of linux oscillates my world" - [EMAIL PROTECTED]
signature.asc
Description: Digital signature
