================================== Unix Lab 5 (Shell Loops and Menus) ================================== - Prepared by Ian Allen - idallen@ncf.ca Work along with your instructor solving the following problem: "You have some friends who need help staying awake while they work on their Unix homework. You volunteer to help keep them awake by sending them inter-terminal messages using the Unix "write" command. You arrange with each different friend what message they would like to see on their screen. To make your life easier, you write a menu program that remembers the message for each of your friends. You type in the name; the script picks the correct message and sends it." Work with your instructor to build this script: 1) Login twice to ACADAIX. (Use two telnet windows.) 2) Send yourself a message using "write", e.g. "date | write $USER". Make a note of which window receives the output of "write". Work in the *other* window while we write this script. The window receiving the "write" output will be receiving all kinds of messages; you won't be able to work in it. Use the non-write window. 3) Test the "banner" command. Try this: $ banner Hello There! You should see the words Hello There! in big letters on your screen. Now, pipe the output of banner into write to your other window: $ banner Hello There! | write $USER You should see the big letters appear in your other telnet window. 4) Pick three people in the room to whom you will be sending wake-up messages. Find out their names and Unix userids and what short message they would like you to send to their screens. (The banner command output doesn't look good unless you keep your banners to a few words.) 5) Write a looping menu script (similar to the ones in Chapter 22) that prompts you for the name or userid of your friend and then sends him/her the appropriate banner message using the "write" command. The script might look like this in operation: $ ./wakeup Enter the name: billy You entered: billy Sending "Wakie! Wakie!" to "billy" (userid abcd0001). Message sent. Enter the name: bessie You entered: bessie Sending "Yo! Wazup!" to "bessie" (userid abcd0002). Message sent. Enter the name: q You entered: q Quitting the script - bye now! 6) Test your script with your three volunteers.