Test grep result
grep "somestring" somefile if [ "$?" -eq 0 ]; then echo "processing somefile" fi
Test environment variable
if [ -n "${ENV_VAR+x}" ]
then
... do something ...
else
... do something else ...
fi
Test if a program is installed
if which program >/dev/null; then
echo program found
else
echo program not found
exit 1
fi
