James G. Sack (jim) wrote: > Stewart Stremler wrote: >> begin quoting James G. Sack (jim) as of Wed, Sep 12, 2007 at 04:40:33PM >> -0700: >>> Christopher Smith wrote: >>>> Chuck Esterbrook wrote: >>>>> Let's say I have a script at /usr/bin/foo which is really just a link >>>>> to /usr/local/blah/bin/foo >>>>> >>>>> When I type "foo" at the command prompt (say bash), I would like the >>>>> foo script to know where it's really homed at. However, "dirname $0" >>>>> in that script will give "/usr/bin" instead of "/usr/local/blah/bin". >>>>> >>>>> Is there a way for a script to find out where it's really located? >>>>> >>>> man realpath >> nice! >> >>> In a shell there's also -P options in these commands: >>> pwd >>> cd >> % cd -P >> Usage: cd [-plvn][-|<dir>]. >> % >> >> What /should/ -P do? >> > > > On bashes I have known, > > cd symlink_to_somplace > pwd (shows symlink name) > pwd -P (shows someplace) > cd -P symlink_to_someplace > pwd (shows someplace) >
My apologies for answering a different question than was asked <heh>. Regards, ..jim -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
