On Sun, Jul 21, 2013 at 4:54 PM, Michael <[email protected]> wrote:

>
> Use the command "pwd".
>
>
> Nope. That tells me where the user is, not where the shell script is.
>

Are you sure? If you do say,

SCRIPT_DIR=`pwd`
echo "$SCRIPT_DIR"

the echo should return the directory the script ran in.

> 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
>
>
>  ---
> This message was composed with the aid of a laptop cat, and no mouse
>
>


-- 
Best Regards,

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

Reply via email to