The ps command is different on BSD (Berkeley UNIX), System 5 (AT&T UNIX), and Linux. On System 5, the command to list all processes is
ps ef
On BSD UNIX, the command is
ps aux
On Linux, the command is
ps -aux
Write a program called systype that will check for a number of different system types. The cases to test for will be
AIX
Darwin (Mac OS X)
Free BSD
HP-UX
IRIX
Linux
OS
OSF1
SCO
SunOS (Solaris/SunOS)
ULTRIX
Solaris, HP-UX, SCO, and IRIX are AT&T-type systems. The rest are BSD-ish.
The version of UNIX you are using will be printed to stdout . The system name can be found with the uname “s command or from the /etc/motd file.
Write a script called timegreet that will do the following:
Provide a comment section at the top of the script, with your name, the date, and the purpose of the program.
Convert the following program to use the case command rather than if/elif .
#!/bin/bash # Comment section you=$LOGNAME hour=$(date +%H) echo "The time is: $(date +%T)" if ((hour > 0 && hour < 12)) then echo "Good morning, $you!" elif ((hour == 12)) then echo "Lunch time!" elif ((hour > 12 && hour < 16)) then echo "Good afternoon, $you!" else echo "Good night, $you. Sweet dreams." fi