(Solved) : Exercise Create Script Called Ifthenelsesh Uses Else Statement Ifthenelsesh Script Use One Q44099177 . . .
- In this exercise, you will create a script calledif_then_else.sh that uses an IF THENELSE statement.
- The if_then_else.sh script will
- Use one command line argument, which will be a number between 1and 10
- Assign the value of the first argument to a local variablecalled NUM. HINT: Look at line 5 in the examplescreenshot for arguments.sh
- Use one IF THEN ELSE statement to compare thevalue of NUM
- If the number is less than 5, display the message “Thenumber is less than 5“
- If the number is 5 or greater, display the message “Thenumber is 5 or greater“
- When running
- Here are some hints
- Watching the video about IF THEN ELSE/ELIF Statement may behelpful
- The IF THEN ELSE statement has the form
If [ $NUM operator number ]
then
echo “<message>”
else
echo “<message>”
fi
- There must be a space after each element toavoid syntax error messages; i.e. there must be aspace after the bracket, $NUM,operator and number
- Decide which integer operator to use. Look atthe slide “Integer Operators“
- Decide what the value of number shouldbe.
- Decide which message should go where
Expert Answer
Answer to In this exercise, you will create a script called if_then_else.sh that uses an IF THEN ELSE statement. The if_then_else…
OR