Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following Bourne shell script is used to loop through the files in the home

ID: 3809330 • Letter: T

Question

The following Bourne shell script is used to loop through the files in the home directory (~). For each C file, ask whether the file should be duplicated (with extension. new added in new file's name), mailed to you (with only the content), or removed (D/M/R) and then take the appropriate action. #!/bin/sh for file in A do valid Option="False"; while (B.] do echo "Please enter your choice for file: " $file echo "[Duplicate(D) Mail(M) Remove(R))" C. case Choice in d|D) D valid Option= True ?; m|M) mail ylonq4Cgsu.edu B valid Option*"True";; r|R) rm $fil valid Option*"True echo "That is not a valid option... valid Point" False"? done The following Bourne shell script and C program can accomplish the same task: read a number from user's input and reverse digits of this number.

Explanation / Answer

Please find the answers below:

A) for file in ~/* (all directories under ~ directory)

B) While["$validOption" != "True"] (loop till the validOption becomes False)

C) read choice (read the choice from user)

D) d|D) cp "$file" "$file.new" (duplicate the current file in the iteration with a .new extension)

E) m|M) mail ylong4@gsu.edu < $file (mail the contents of current file in the iteration)

F) *) echo "That is not a valid option"(for all other cases)