Wednesday, 1 October 2008

Script Menu di Linux

$vi menu


#
# Script to create simple menus and take action according to that selected
# Menu Item
#
while :
do
clear
echo "--------------------------------------------"
echo " Main Menu ---> Created by David W"
echo "--------------------------------------------"
echo "[1] Show Today date / Time"
echo "[2] Show Files in Current directory"
echo "[3] Show Calendar"
echo "[4] Start Editor to Write Letters"
echo "[5] Exit/Stop"
echo "============================================"
echo -n "Enter your menu choice [1-5]:"
read yourch
case $yourch in
1) echo "Today is `date` , press a key...";read ;;
2) echo "Files in `pwd`";ls -l ; echo "Press a key...";read ;;
3) cal ; echo "Press a key...";read ;;
4) vi ;;
5) exit 0 ;;
*) echo "Opps!!! Please Select Choice 1,2,3,4, or 5";
echo "Press a key...";read;;
esac
done


save wq!

running
$./menu

Reference ; Linux Shell programming

No comments: