Description:
Bash scripting. Error value returned from bash script using $? variable. Simple bash script example:
$ cat bash-127.sh
#bin/bash
non-existing-command
echo $?
Operating System:
Any Linux/Unix
Error:
$ ./bash-127.sh
./bash-127.sh: line 3: non-existing-command: command not found
127
Solution:
Value 127 is returned by your shell /bin/bash when any given command within your bash script or on bash command line is not found in any of the paths defined by PATH system environment variable. Make sure that the command your are using can be found within your $PATH. If the command is not in your path either include it or use absolute full path to it. For more information see EXIT STATUS section of the bash man page.