Hi Guys,
How can I exit from the shell script if a condition is not met?
Thanks in advance...
Hi Guys,
How can I exit from the shell script if a condition is not met?
Thanks in advance...
Use this
if [ condition not met ]; then
echo "Exiting"
exit
fi
Yes, but I think the point may be that the OP is missing is how to use the exclamation point to reverse the sense of a test.
if [ ! "x$abc" = "x" ]
then echo '$abc is not an empty string'
exit 1
fi