Hi Guys,
Please can some one explain me the below part of code. In this code what is the use of the line in Bold.
COPY=0
if [ -s $CONF ]; then
echo "$CONF exists and is non-empty - backing it up"
SUFFIX=`date +%Y%m%d%H%M%S`
echo "cp -p $CONF $CONF.$SUFFIX"
cp -p $CONF $CONF.$SUFFIX
[ $CLOBBER -ne 0 ] && COPY=1
else
COPY=1
fi
Regards,
Abhishek
It means 'if the variable CLOBBER is not zero then set COPY=1'
Ok Thanks for the help....
Regards,
Abhi
broli
August 6, 2008, 8:51am
4
you better read what && means
Operators
also read this
Test Constructs
One more query......
I am trying to assign a value to a variable but getting error....
IP_ADDR=${`grep 'I.P. Address' /install/cfgdist/`uname -n`.cfg | cut -d : -f 2| cut -d . -f 1-3| sed s/" "//g`}
I am using this script to grep first three octets of an IP address from a file and assign the value to IP_ADDR....but I am not able to assign the value to the variable...
Please some one help.
Regards,
Abhishek