False Condition

Hi All,

I am using the below Script to enter a line in the File:

#!/bin/ksh
# To delete the last line if it contains the pattern Redirect permanent / Virgin Atlantic Airways - Popup
echo "Enter the URL that should point to the particular microsite"
read url
# To delete the last line if it contains the pattern Redirect permanent / Virgin Atlantic Airways - Popup
if [ -z "$value" ]; then
echo "You have not enterd the URL" ; exit 1
else
grep "Redirect permanent / http://www.virgin-atlantic.com" redirects.virgin-atlantic.com.conf > output1
if [ $? -eq 0 ] ; then
rm -r output1
sed '$d' redirects.virgin-atlantic.com.conf > temp
cp temp redirects.virgin-atlantic.com.conf
echo $url >> redirects.virgin-atlantic.com.conf ;
echo "Redirect permanent / http://www.virgin-atlantic.com" >> redirects.virgin-atlantic.com.conf ;
echo "Redirects Setup"
else
echo $url >> redirects.virgin-atlantic.com.conf ;
echo "Redirects Setup"
fi
fi

but the script is not entering the else part after checking for the first if condition.

Please can somebody advise.

Best Regards,
Shazin

---------- Post updated at 09:23 PM ---------- Previous update was at 09:00 PM ----------

Sorry very silly mistake.... :slight_smile: