The command "exit" terminate script and return value:
Every command returns an exit status, sometimes it is called exit code or return status.
0: Script was executed with success.
1 and greater: Script was executed with error. Non-zero return value is interpreted as an "error code".
If you want to get exit value last executed script use $?.
./script.sh
echo $?
Sometimes you can see exit $?, which is equivalent to exit.
Was this information helpful to you? You have the power to keep it alive.
Each donated € will be spent on running and expanding this page about UNIX Shell.
We prepared for you video course Marian's BASH Video Training: Mastering Unix Shell, if you would like to get much more information.
Thank you. Marian Knezek