On Tue, 2006-01-31 at 10:16 -0500, Juergen Fiedler wrote: > On Tue, Jan 31, 2006 at 02:26:27PM +0000, michael wrote: > > Presuming I have a file setEnvVars.sh that I wish to source, > > . path/setEnvVars.sh > > How do I, within the script, determine the actual directory within which > > the setEnvVars.sh file sits? The sourcing seems to disallow me access to > > $0 etc > > > > thanks, M > > If I understand your question correctly, the '$_' variable should do > the trick.
doesn't seem to: [EMAIL PROTECTED]:~/models-3/CMAQ-4.5/scripts$ head ../defineEnvVars #!/bin/bash echo $_ [EMAIL PROTECTED]:~/models-3/CMAQ-4.5/scripts$ . ../defineEnvVars ../defineEnvVars [EMAIL PROTECTED]:~/models-3/CMAQ-4.5/scripts$ cd cctm [EMAIL PROTECTED]:~/models-3/CMAQ-4.5/scripts/cctm$ . ../../defineEnvVars cctm what I am trying to do in the script is get it to work out the directory in which defineEnvVars live, irrespective of which directory I am when I run . [path]/defineEnvVars thanks, michael -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]