I thought that I could get this from $0. But in my tests, if the script
is on the PATH and I invoke it just with its name, I get just its name
in return. For example:

PATH=/usr/local/bin

/usr/local/bin/dd.sh contains:

#!/bin/sh
echo $0

I invoke via:

$dd.sh

result is 

dd.sh

with no indication of where it came from. Even worse:

cd /usr/local/bin
mv dd.sh ..
ln -s ../dd.sh temp.sh
temp.sh

results in:

../dd.sh

I don't know that it was invoked by "temp.sh", so I can't do a which to
find out where it is from. I want to know so that I can have some
scripts in a subdirectory which are not on the PATH. I then have a
symlink to the "driver script" which is on the PATH. The "driver script"
needs to determine the directory that it actually came from (the regular
file, not the symlink) so that it can change the PATH for the duration
of the script in order to execute other program and scripts from that
same directory.

I'm likely missing something simple. I hope. Thanks.

--
John McKown
Senior Systems Programmer
HealthMarkets
Keeping the Promise of Affordable Coverage
Administrative Services Group
Information Technology

The information contained in this e-mail message may be privileged
and/or confidential.  It is for intended addressee(s) only.  If you are
not the intended recipient, you are hereby notified that any disclosure,
reproduction, distribution or other use of this communication is
strictly prohibited and could, in certain circumstances, be a criminal
offense.  If you have received this e-mail in error, please notify the
sender by reply and delete this message without copying or disclosing
it. 

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to