In Linux(use putty), Develop, test and execute a menu driven Shell Script progra
ID: 3857022 • Letter: I
Question
In Linux(use putty), Develop, test and execute a menu driven Shell Script program to do the following tasks:
1) Display server IP address, server name, and server Linux flavor
2) Display all users currently on the server
3) Display all login ids in alphabetical order
4) Compress user home directory into a single file
5) Display the present working directory
6) Display a listing of the current directory, long format and hidden files
7) Display the current date
8) Display the current users id
9) Exit
Enter selection: _
Note: Your program should run forever until the user chooses to quit - (option 9).
Explanation / Answer
#!/bin/sh read -p "Select the Option to display [0-9] " NUMBER case $NUMBER in 1) echo -e " ifconfig | perl -nle 's/dr:(S+)/print $1/e hostname cat /etc/issue ";; 2) echo "who" ;; 2) echo "" ;; 3) echo "Three" ;; 4) echo "Four" ;; 5) echo "Five" ;; 6) echo "Six" ;; 7) echo "Seven" ;; 8) echo "Eight" ;; 9) echo "Nine" ;; *) echo "Not a single numeric character!" ;; esac
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.