use of test in shell scripts.
S|ren K. Lundsgaard
skl at kvvax4.UUCP
Wed Dec 11 20:48:03 AEST 1985
This is all very easily solved for both csh and shell scripts.
merely set the correct path for all the commands that you have
used, or will possibly use in the shell script.
for example
#!/bin/sh
# set our explicit path
PATH="/bin:/usr/bin:/usr/ucb:$PATH"
for i in p px ph tr
do
if test -d $i
then
dirnames="$dirnames $i"
fi
done
.
.
.
Notice that I carried along the old path for good measure, in
case the script runs a shell or something, but I know that I will
get /bin/test, instead of ./test, or any other garbage that is
sitting in the path.
Another option is to save the old path in another environment variable,
and then set it back when you are ready to go on in the old
environment.
----
Um Yah Yah.
skl.
More information about the Comp.unix.wizards
mailing list