If we need to terminate the shell script and come back to the command line, then we can use the exit command. The syntax is very simple:
exit 0
The given command will terminate the shell script and return to the command line. It will store the 0 value in the ? status variable. We can use any value between 0 and 255. Value 0 means success, and any other non-zero value means an error. We can use these values to indicate error information.
The script to check the value of a parameter that is passed along with the command (either less than 0 or greater than 30) is as follows. This will save us from using the nested if statement:
#!/bin/bash if (( $1 < 0 || $1 > 30 )) then echo "mdays is out of range" ...