CS 497C - Programming Assignment 2 - Name:_____________________________ DUE: Wednesday, December 5 (in class) o Please show all work on a separate sheet attached to this sheet when you turn it in. o For each exercise, submit a listing of your source code along with scripted output showing that the code executes correctly. To generate scripted output on the UNIX system, use the "script" command. o Put your name in each script and add some necessary comments. These are a part of grading in this assignment. o Both the hard copy and the electronic copy should be submitted. o For each exercise, submit a runnable script and scripted output. The names of the script should be ex1, ex2, and ex3 respectively and the scripted output is ex.out. o Use the handin system to submit all code electronically. The submission ID is 2: ~cs497c/bin/handin 2 ex1 ex2 ex3 ex.out o Thanks! (110 points) 1. Write a script to back up multiple files into a directory, create the directory if the directory doesn't exist, and display the message indicating the number of files has been successfully backed up. The last argument to the script is the directory. (hint: Modify cpback2.sh on the page 573) (30 points) $ ls foo1 foo2 foo3 foo4 foo5 foo6 $ ex1 * progs The directory progs is created. 6 files have been backed up into the directory progs. $ ls foo1 foo2 foo3 foo4 foo5 foo6 progs $ ls progs foo1 foo2 foo3 foo4 foo5 foo6 2. Write a command menu as follows: $ ex2 Command Menu a. Enter a welcome message and write this message to a file msg. b. Send the contents of the file msg to all users who are logged in. c. Display the process status in the system five times every 10 seconds. Enter a, b, or c: The function for each selection is as indicated in the menu. (hint: b. Use the mail command. For example, mail username < msg.) (40 points) 3. Write a script to read in at least ten scores, sorts them, prints them out in an descending order, and calculate their sum and average. (hint: Use arrarys.) (40 points) $ ex3 Input 10 scores: 89 53 62 90 88 74 77 86 95 91 Ordered scores: 95 91 90 89 88 86 77 74 62 53 The sum of all the scores is 805. The average is 80.5.