On 7/27/06, Brett Rasmussen <[EMAIL PROTECTED]> wrote:
I have a script that needs to run a remote script over ssh on a different
box, and the remote script is in some directory other than the home dir.
The remote script is a ksh shell script that calls other scripts in its
own directory.
Since the remote script is being called with its path, it doesn't execute
from within that directory and therefore can't find the other scripts there.
Does anyone know how I'd do such a thing?
Inside your script you can do (this is bash syntax, so translate to
ksh if that's different):
DIRNAME=`dirname $0`
And $DIRNAME will contain the directory that contains your script.
Then you can either add that to your path or call the other scripts
explicitly.
Really your trouble is that you're assuming . is in the path, which it isn't.
If, for some reason, you can't change any of the scripts then you'll
opt to add that directory to PATH.
export PATH=/pth/bin:$PATH
Remember that unless it's exported only the parent script can see it,
not the children.
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/