Satyak
1
Hi,
i am trying to get the no of users using
nofActUsers=$(echo /usr/sbin/lsof -l | grep "/mast/data/users" )
it will return blank, if the user does nto have permissions to run the script.
Now I need to check if the valueis blank i have route to another script else the user has to continue this script.
Please help
Thanks in advance
Satya
Some possibilities:
nofActUsers=$(/usr/sbin/lsof -l | grep "/mast/data/users")
if [ -z "$nofActUsers" ]
then
echo "nofActUsers is empty"
fi
or:
if [ "$(/usr/sbin/lsof -l | grep "/mast/data/users")" = "" ]
then
echo "No output"
fi
or:
usr/sbin/lsof -l | grep "/mast/data/users" > /dev/null
if [ $? -eq 0 ]
then
echo "Output not blanc, do your stuff..."
fi