#! /bin/sh clear ################################################################# # script_1, version 01, Claudio Rocha # # This is a Bourne Shell Script # # Usage: script_1 # # This Script is written for "Homework - Dr. Halasa # ################################################################# ####################################################### # Full menu access if logged as root ####################################################### while true do clear user=`/usr/ucb/whoami` if [ $user = root ] then echo "Script will run all options, because you logged in as root" else echo "\n\n\n" echo "Warning...$user, some of the options may not work," echo " you must be logged as root to gain full" echo " menu options access" fi echo "\n\n" echo "Would you like to continue [y/n - default=n]:_\b\c" read ans ans=${ans:-n} if [ $ans = y ] then while true do clear ####################################################### echo " License Administration Menu" ####################################################### echo echo " 1 -- Display contentes of /etc/passwd" echo " 2 -- Display contentes of /etc/group" echo " 3 -- Display contentes of /etc/shadow" echo " 4 -- Show Memory in this machine" echo " 5 -- Show status of processor(s)" echo " 6 -- Show all patches installed in this machine" echo " 7 -- EXIT" echo echo " Please choose option: _\b\c" read option option=${option:-7} case $option in 1) clear echo "############################" echo "This is the /etc/passwd file" echo "############################" echo cat /etc/passwd |more echo echo echo "Press Enter to continue..." read _ENTER ;; 2) clear echo "############################" echo "This is the /etc/group file" echo "############################" echo cat /etc/group |more echo echo echo "Press Enter to continue..." read _ENTER ;; 3) clear echo "############################" echo "This is the /etc/shadow" echo "############################" echo case $user in root) clear echo "############################" echo "This is the /etc/passwd file" echo "############################" echo cat /etc/shadow |more echo echo echo "Press Enter to continue..." read _ENTER ;; *) echo echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo "+ +" echo "+ This option only works with root provilegies +" echo "+ +" echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++" echo echo "YOU MUST BE LOGGED IN AS ROOT TO READ THIS FILE..." echo echo "Press Enter to continue..." read _ENTER ;; esac ;; 4) clear echo "################################" echo "Memory Available in this Machine" echo "################################" echo showrev echo echo prtconf -v | grep Memory echo echo echo "Press Enter to continue..." read _ENTER ;; 5) clear echo "############################" echo "Status of Processor(s)" echo "############################" echo psrinfo -v echo echo echo "Press Enter to continue..." read _ENTER ;; 6) clear echo "##########################################" echo "Show all patches installed in this machine" echo "##########################################" echo showrev -a |more echo echo echo "Press Enter to continue..." read _ENTER ;; 7) echo echo "Exinting Script..." sleep 1; clear; break ;; *) echo "Invalid entry" sleep 2 ;; esac done elif [ $ans = n ] then echo "exiting script..." sleep 2 clear echo done. exit 15 else echo "Invalid Option!" sleep 2 fi done