to expand on this answer you can use ` to save the result of the command. Try this
HERE=`pwd` echo $HERE so now the current path is in a variable for your script to use. On Jul 21, 2013, at 3:46 PM, John Musbach <[email protected]> wrote: > Use the command "pwd". > > > On Sun, Jul 21, 2013 at 4:16 PM, 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? > > I am trying to run a program that wants an ini file specified on the command > line; but it defaults to the assumption of having its config file in /etc > unless you tell it where it is. And rather than a one-line script that hard > codes a directory, I'd rather that it (the script) can tell where it is > located, to use an ini file there. > > (Yea, a one-line script to just pass a config file argument to a program.) > > --- > This message was composed with the aid of a laptop cat, and no mouse > > _______________________________________________ > MacOSX-talk mailing list > [email protected] > http://www.omnigroup.com/mailman/listinfo/macosx-talk > > > > -- > Best Regards, > > John Musbach > _______________________________________________ > MacOSX-talk mailing list > [email protected] > http://www.omnigroup.com/mailman/listinfo/macosx-talk -- Bob Love "Atheism is a non prophet organization."
_______________________________________________ MacOSX-talk mailing list [email protected] http://www.omnigroup.com/mailman/listinfo/macosx-talk
