Quiz 3 (Due in or before class, 4th week)

(Remember: your shell is not "sh", please type "sh" or "bash" before attempting any of the interactive examples from the text.)

Question 1: Shell programming 1
Write a shell script that verifies that the password file makes sense. Have it announce duplicate logins and UIDs, check to make sure each user has a password, and that every ones home directory and shell exists. If you can't remember what the fields are in the passwd file, see passwd(4). For detecting duplicates, examine the utilities uniq, comm, cmp. You are welcome to use temporary files, provided that you take precautions to make sure you don't overwrite someone elses file.

Question 2: Shell programming 2
Write a shell script (call it "run-on-all-logins") that will cycle through all of the user logins and run another command (provided at run time as $1) on each user login. An example interaction might be here. Write a shell script (call it "count-procs") that counts the number of processes a user has. Have it take the login name as $1. Use these two shell scripts to give you a list of how many processes each user has running on a given machine. Assume the BSD style "ps" (available in /usr/ucb on Solaris).

Question 3: Boot sequence Be aware of the Sun manual pages monitor(1), boot(1), eeprom(1). Read them (but you wont be required to repeat anything from them). Believe it or not, the PC BIOS is considered the more difficult to use. The reason: BIOSs are all different (even within a vendor). Visit the page for one of ASUSs motherboards, the P5A-B . Read the users manual, and the jumper settings. This is why people hate the BIOS.