in reply to Checking a command is running

The first problem is that you've written a shell script in Perl. Perl can do all those things: grep, awk, sleep without all the backticks. And if you are adventuresome, you can use a module to replace the functionality of ps too.

Now onto your actual bug. You need to use "eq" to do your string comparison. "==" does a numerical comparison and since neither string has any numbers in it you get "0 == 0" and therefore it's true.

while ($RUNDBCOLD eq (`ps -ef | grep -v grep | grep "nscd" | awk -F/ ' +{print \$4}'`))

HTH