Question: LINUX In Linux command line write a shell script ex1.sh that uses IF THEN to Prompt the user to Enter a number between 1 and

LINUX

In Linux command line write a shell script ex1.sh that uses IF THEN to

Prompt the user to "Enter a number between 1 and 10". (Hint: Use the 'echo' and 'read' commands in the script. See the slide about the 'read' command)

If the number is less than 5, print "The number is less than 5" (Hint: You will read input into a variable; e.g. read NUM. In the IF statement, enclose $NUM in quotes; e.g. "$NUM". Also, remember you want to use the Integer Operators like lt.)

Run 'cat ex1.sh'

Run 'sh ex1.sh' and enter 3 when prompted

Run 'sh ex1.sh' and enter 5 when prompted

Run 'sh ex1.sh' and enter 7 when prompted

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!