current dir from .command scripts

Scot Hacker shacker at birdhouse.org
Fri Aug 3 12:03:20 PDT 2007


On Aug 3, 2007, at 11:32 AM, David P. Henderson wrote:

> In a GUI what is the current working directory? ~/ seems reasonable  
> or should it be the frontmost window? the desktop? the directory in  
> from which the app was launched? Current working directory perhaps  
> lacks meaning in a GUI metaphor, meaning which exists in a shell.  
> Or maybe the current working directory in a GUI, at least on Mac OS  
> X, should always be the desktop?
>

To my mind, the directory  from which the script was launched seems  
like it would be by far the most logical choice (exactly as  if you  
were working from the shell).

On Aug 3, 2007, at 11:54 AM, Mike Galloy wrote:
> echo `dirname $0`

Bingo!  That nails it. Thanks heaps, Mike Galloy.

Scot



More information about the MacOSX-talk mailing list