[net.unix-wizards] use of test in shell scripts.

skl@kvvax4.UUCP (S|ren K. Lundsgaard) (12/11/85)

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.