current dir from .command scripts
steve harley
steve at paper-ape.com
Fri Aug 3 11:09:22 PDT 2007
they whom i call Scot Hacker wrote:
> So it seems like double-clicked shell scripts aren't able to
> determine the actual current working directory. Anyone know of a
> workaround for this?
opening a .command script simply opens a Terminal window and then
executes the script text; it doesn't carry any directory
assumptions with it, so it simply runs in the default directory
for Terminal
one workaround i can think of is to wrap the shell script in an
AppleScript saved as an applet; the applet can find the path to
itself like this:
set pwd to POSIX path of (path to me as string)
and pass it to the shell script like so:
do shell script "~/script/myscript " & pwd
More information about the MacOSX-talk
mailing list