- $? contains the return code of the most recent command
- PREVCOMM=$?
if [[ $PREVCOMM -ne 0 ]]; then
echo "whoa, something failed"
exit 1
fi
- old school check to see if a variable is defined:
if [[ $MYVAR"x" == "x" ]]; then
- variables with interesting characters inside:
"$MYVAR"
${MYVAR}
"${MYVAR}"
INDEX
PREVIOUS
Master Index