On Wed, 2008-02-27 at 19:26 -0600, Kathryn Hogg wrote:
> If you want to print just the directory that the script is located in do
> 
> (cd $(dirname $0); pwd)

This looks like a winner to me.  To handle spaces and at least some
other nastiness, this seems to work 

(cd "$(dirname "$0")"; pwd)

I've had it work with directories including newlines and backslashes. I
was a little surprised, but apparently bash separately parses
double-quotes which are within $( .. ) blobs.

I might change the semicolon to '&&'.  If there's somehow an error,
you'd most likely get a zero-length return string instead of the
original workind dir, and $? would be set non-zero.

-- 
Mike Hicks <hick0088 at tc.umn.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20080227/3584077f/attachment-0001.pgp