The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-29-2008
infyanurag infyanurag is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 65
no value in variable

here is a small snippet from the code.

grep -i "updated" testing > testing1
#rm -f testing
Noupdated=`cut -d " " -f1 testing1`
if [ $Noupdated -eq 0 ]
then
echo "No Match Found"
else
echo "Number Of Rows Updated :---> $Noupdated"
fi

the problem is if Noupdated does not have any value, the if condition gives the error.

how to resolve this?

thanks