Explanation The return value of a shell script after successful execution is 0. This is a convention followed by most UNIX and Linux commands, programs, and utilities. A return value of 0 indicates that the command or script completed successfully, without any errors. A return value of non-zero (1-255) indicates that the command or script failed, and the value can be interpreted as an error code. The return value of a command or script is stored in the special variable $? and can be used to test the outcome of a command or script123. For example, the following script will print a message based on the return value of the ls command: #!/bin/bash ls if [ $? -eq 0 ]; then echo "ls command executed successfully" else echo "ls command failed" fi References: 1: Exit and Exit Status - Linux Documentation Project 2: Linux Passwd Command Help and Examples 3: bash - Which is the best way to check return result? - Unix & Linux Stack Exchange