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: 3809155 • 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 (DM/R) and then take the appropriate action. #!/bin/sh for file in ___A.___ do validOption = "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._____ validOption = "True";; m|M) mail ylong4@gsu.edu ___E.___ validOption = "True";; r|R) rm $file validOption = "True";; echo "That is not a valid option ellipsis" validOption = "False";; esac done done

Explanation / Answer

A. ~/*
B. [ $file == *.log ]] && [[ $validOption == False ]
C. read choice
D. cp $file $file.new
E. < ~/$file
F. *)

A. ~/* : all files in the home directory

B. consider only file with extension .c

C. read choice : get the choice from user

D. cp $file $file.new : copy $file to $file.new

E. < ~/$file : content of file $file in the homedirectory is redircted to send mail

F. Deault condition of case