On 21 Jul 2013, at 14:16 , Michael <[email protected]> wrote:

> I feel silly for asking this. But I just realized I don't try this very often.
> 
> Is there a way for a shell script to find itself? Or more precisely, the 
> directory it is in?

Yes, but it depends on the shell.

DIR="$( cd "$( dirname "$0" )" && pwd )" 

will always<1> set the DIR to the path the script is in in bash, for example. 
That command is space safe so you will end up with "/Users/myname/My Shell 
Script/script One.sh” in DIR if need be.

<1> FSVO of always

-- 
There is no Humpty Dumpty, and there is no God. None, not one, no God,
never was.

_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk

Reply via email to