Question on Verifying root's current directory

From a script how would I verify that the current directory (.) is not in root's path. Now when the script is going to be run the auditor wil not be signed in as root, but rather running it via sudo, so I'm thinking the standard $path won't work for that case.

Derek:confused:

Do you mean verify that the PATH variable does not have a dot for the current directory?

echo $PATH | grep -q -e '\.:' -e ':\.$' && echo "PATH env variable fails . test"

Otherwise I don't understand...

I think he means that he is sitting in a filesystem - say
/audit
(so if you issued say "bdf ." it would be the same as "bdf /audit"

and he wants to make sure that /audit is not in root's $PATH
but if the auditor is signed on via sudo - will the $PATH command work properly to answer the question?

(I have no idea if that's the same as what you said Jim, but that's how I read the question)

The problem I am having is that the $PATH variable for the process running under sudo does not reflect the �run as� user�s $PATH, rather it remains set to the calling user�s $PATH.

For example roots actual $PATH when logged in is:

/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin

But, when a script is run as root, using sudo, the value of $PATH is the calling user�s $PATH:

/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/dcjones/bin:/usr/bin/X11:/sbin:.

What the script is checking for is that the root user does not have the current directory �.� in its $PATH; what the script is seeing is not root�s $PATH