The exit status is an integer number. variable. If N is set to 0 means normal shell exit. is 0. I open a shell on my computer and in the current directory I have the following files: If I use the cat command to see the content of the file test_file1 the exit code stored in the variable $? The else branch prints a successful message and it’s executed only if the value of $? Different values of N are used to indicate if the script exits with success or failure. Instead of “hoping” that nothing will go wrong with your program, you can predict possible failures and decide how your program will react to those. 4. The most common use of the trap command though is to trap the bash-generated psuedo-signal named EXIT. Every executable script may begin with a shebang. Bash exit command#. Every Linux or Unix command executed by the shell script or user, has an exit status. If a command is found but is not executable, the return status is 126. Likewise, functions within a script and the script itself return an exit status. $ bash