Question: Unix/Lunix Programming Exercise 5 Read the following script interactive_mode and answer the question. # interactive mode if [[ -n $interactive ]]; then while true; do

Unix/Lunix Programming

Exercise 5

Read the following script interactive_mode and answer the question.

# interactive mode

if [[ -n $interactive ]]; then

while true; do

read -p "Enter name of output file: " filename

if [[ -e $filename ]]; then

read -p "'$filename' exists. Overwrite? [y/n/q] > "

if [[ "$REPLY" == "y" ]]; then

break

elif [[ "$REPLY" == "q" ]]; then

echo "Program terminated."

exit

fi

elif [[ -z $filename ]]; then

continue

else

break

fi

done

fi

Assume that interactive is not empty.

What are the next five commands that will be executed if user provides an empty filename?

What is the next three commands being executed if user supplies a non-existing filename?

What is the next two commands being executed if user supplies an existing filename?

If user then provides n, what are the next three commands being executed?

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!