Why does bash set $? (exit status) to non-zero on Ctrl-C or Ctrl-Z?
From the bash manual, on the $?
variable:
From the bash manual, on the $?
variable:
I started learning Bash a couple of days ago.
Say I am writing my own init program running on a Linux kernel.
I’m having difficulty locating a comprehensive up-to-date list of error codes from Bash. e.g.:
So I well understand that exit code of 0
is considered success in running of a program. Then we use this in bash scripts with logical AND
and OR
to run the next program based on the exit status of the first program. A good example can be found here: https://unix.stackexchange.com/a/187148/454362
I want to know what return values we can use that will not be mistaken by for ex. SIGINT?
I’ve script as below :-
(edited)
See the following examples and their outputs in POSIX shells: