Question: Unix/Lunix Programming Exercise 2 Read the following script read_menu and answer the questions. echo Please Select: 1. Display System Information 2. Display Disk Space

Unix/Lunix Programming

Exercise 2

Read the following script read_menu and answer the questions.

echo "

Please Select:

1. Display System Information

2. Display Disk Space

3. Display Home Space Utilization

0. Quit

"

read -p "Enter selection [0-3] > "

if [[ $REPLY =~ ^[0-3]$ ]]; then

if [[ $REPLY == 0 ]]; then

echo "Program terminated."

elif [[ $REPLY == 1 ]]; then

echo "Hostname: $HOSTNAME"

uptime

elif [[ $REPLY == 2 ]]; then

df -h

elif [[ $REPLY == 3 ]]; then

echo "Home Space Utilization ($USER)"

du -sh $HOME

fi

exit

else

echo "Invalid entry."

exit 1

fi

If the script is executed and a user provides 4 as the input, what shall be the output of the program?

If the script is executed and a user provides 1 as the input, what shall be the output of the program?

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!