The return value depends on the command you are calling. It's different for each command. Generally if you want to see the exit codes for any given command you look at the man page.
man dd
------
Exit Status
This command returns the following exit values:
0 The input file was copied successfully.
>0 An error occurred.
man diff
--------
Exit Status
This command returns the following exit values:
0 No differences were found.
1 Differences were found.
>1 An error occurred.
man env
-------
Exit Status
If the Command parameter is specified, the exit status of the env command is
the exit status of the command specified in the Command parameter.
Otherwise, the env command exits with one of the following values:
0 The env command completed successfully.
1-125 An error occurred in the env command.
126 The command specified by the Command parameter was found, but could not be invoked.
127 The command specified by the Command parameter was not found.
To see a list of error codes returned by common system calls (not those returned to the shell in $?) you can look at /usr/include/errno.h. There may also be a variety of other errno.h files in subdirectories under /usr/include which should be checked as well; their locations vary across flavours of Unix.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.