Tuesday, March 31, 2015

Commands menu

Program (cmdmenu.sh)
# Menu program
ch='y'
while [ $ch == 'y' ]
do
echo -e "\tMENU
1. List of files
2. Working Directory
3. Date and Time
4. Users of the system
5. Calendar
Enter the option : \c"
read choice
case "$choice" in
1) ls -l ;;
2) pwd ;;
3) date ;;
4) who ;;
5) cal
esac
echo -n "Do you wish to continue (y/n) : "
read ch
done


Output
[vijai@localhost command]$ sh cmdmenu.sh
MENU
1. List of files
2. Working Directory
3. Date and Time
4. Users of the system
5. Calendar
Enter the option : 4
vijai pts/20 Apr 4 13:41 (linux-21.smkfomra.com)
cse1 pts/13 Apr 4 13:43 (scl-58.smkfomra.com)
Do you wish to continue (y/n) : n

No comments:

Post a Comment