The variable $?
contains the last commands return code
EDIT: precise example:
git status &> /dev/null
if [ $? -eq 0 ]; then
echo "git status exited successfully"
else
echo "git status exited with error code"
fi
The variable $?
contains the last commands return code
EDIT: precise example:
git status &> /dev/null
if [ $? -eq 0 ]; then
echo "git status exited successfully"
else
echo "git status exited with error code"
fi