What is the best way to make sure that all the environment variables I need for my script have been set? Currently, I have multiple if-statements which is not very neat:
if [ -z "$VAR1" ]
then
echo VAR1 not set
exit
fi
if [ -z "$VAR2" ]
then
echo VAR2 not set
exit
fi
if [ -z "$VAR3" ]
then
echo VAR3 not set
exit
fi
Is there a better way?