Linux Redhat lab: Shell script: The if-then-elif-fi Construct



Linux Redhat lab: Shell script: The if-then-elif-fi Construct

Linux Redhat lab: Shell script: The if-then-elif-fi Construct

Link playlist
https://www.youtube.com/playlist?list=PLIpLw6v7Z1qmty_yT3KQUeV5jW46Wu7hG
2023 07 07 15 22 56

Script09: The if-then-elif-fi Construct (Example 1)
The if_then_elif_fi.sh script is an enhanced version of the if_then_else_fi.sh
script. It accepts an integer value as an argument and tells if it is positive,
negative, or zero. If a non-integer value or no argument is supplied, the script
will complaint. Notice that the script employs the exit command after each
action to help you identify where it exited.
Run this script four times: the first time with a positive integer, the second time
with 0, the third time with a negative integer, and the fourth time with a non integer value. Check the exit code after each execution to know where the
script exited.
The outputs and exit values reflect the program code.