You can refer to the current working directory with $cwd
. So if you want to call printsth
with a path relative to the current working directory, start the line with $cwd
.
For example, if you want to call the printsth
in the current directory, say:
$cwd/printsth
If you want to call the printsth
one directory above:
$cwd/../printsth
Be sure it's a csh
script though (ie. the first line is #!/bin/csh
). If it's an sh
or bash
script, you need to use $PWD
(for 'present working directory'), not $cwd
.
EDIT:
If you want a directory relative to the script's directory, not the current working directory, then you can do this:
setenv SCRIPTDIR `dirname $0`
$SCRIPTDIR/printsth
That will set $SCRIPTDIR
to the same directory as the original script. You can then build paths relative to that.
set -vx
(or similar for csh) ANDecho $cwd
etc to see where you are at. Good luck. – Phare