Hi all,
I am wondering how can I check when a variable has nothing returned in it. I am trying to store a pid in this variable to see if a script is running in the background. So I am using something like that
proc_pid=`ps -ef |grep script.sh|grep -v grep|awk '{print $2}'`
if [ $proc_pid -ne "" ]
then
<do something>
else
<do something else>
fi
It seems though that this check is not exactly correct since I'm getting the following
... test: Specify a parameter with this command.
Can anyone help me find the correct checking condition?
Thanks in advance