Hello all,
I am having problem in writing a if condition for the following:
I have a file Instance.dat which has:
#Server Environment
server1 dev
server2 dev
server3 sit
#!/bin/ksh
ENV=dev
for i in $( cat Instances.dat | grep -v '#' |awk {'print $2'} )
do
if [[ $ENV = $i ]]
echo "You are deploying the application in $ENV Environment"
cat Instances.dat | grep -i $ENV | awk {'print$1'} | grep -v '#' > hostnames.dat
else
echo "Please check the Environment"
exit
fi
done
Idea is to validate the Env provided in the script against the file but my script doesn't work??
I really appreciate help on this.
Thanks
Chiru