`useradd bob` result=$? echo $result if [ "$result"=="0" ] then echo "created" elif [ "$result"=="9" ] then echo "error: already in use" fi