1. Exit code from Bash script
argument of exit command is exit code
exit n
example (exit_example.sh)
#!/bin/bash
exit $1 #return argument 1 as return code
2. Bash last exit code
last exit code is in variable $?
#!/bin/bash
./exit_example.sh 2
echo $?
result is:
2
No comments:
Post a Comment