Thursday, May 1, 2008

Write a menu driven program which has following options:

Write a menu driven program which has following options:

a) contents of /etc/passwd

b) List of users who have currently logged in

c) Present working directory

d) Exit

Make use of a case statement. The menu should be placed approximately in the center of the screen and should be displayed in bold using the tput statement.

# SS17

# Menu driven program

# Usage: SS17

clear

while true

do

clear

tput cup 10 20

echo “1. contents of/etc/passwd”

tput cup 11 20

echo “2. List of users who have logged in”

tput cup 12 20

echo “3. Present working director”

tput cup 13 20

echo “4. Exit”

tput cup 15 20

echo “Your choice?”

read ans

clear

case $ans in

a) cat/etc/passwd;;

b) who;;

c) pwd;;

d) exit;;

esac

echo “n\nPress any key to continue...”

read key >/dev/null

done

2 comments:

Anonymous said...

plz..post the output..as well..

its not working

Anonymous said...

plz post the output as well..

its not working