Simple shell script
Posted: September 29, 2009 at 10:38 pm | Tags: Linux, shell scriptThis is a simple shell script. This is what it can do:
[1] Display curent time and date
[2] Display files from current folder
[3] Display the calendar
[4] Start an text editor
[5] Harddisk information
[6] Verify resourcesit.com with ping
This is the complete script. Feel free to use or modify as you like to:
while :
do
clear
echo “————————————-”
echo ” Test Menu – www.etuts.resourcesit.com ”
echo “————————————-”
echo “[1] Display curent time and date”
echo “[2] Display files from current folder”
echo “[3] Display the calendar”
echo “[4] Start an text editor”
echo “[5] Harddisk information”
echo “[6] Verify resourcesit.com with ping”
echo “[7] Exit/Stop”
echo “=======================”
echo -n “Select option [1-7]: ”
read yourch
case $yourch in
1) echo “Today’s date is `date` , Hit enter to resume. . .” ; read ;;
2) echo “`pwd` files are:” ; ls -l ; echo “Hit enter to resume. . .” ; read ;;
3) cal ; echo “Hit enter to resume. . .” ; read ;;
4) gedit ;;
5) df ; echo “Hit enter to resume. . .” ; read ;;
6) ping resourcesit.com ; echo “Hit enter to resume. . .” ; read ;;
7) exit 0 ;;*) echo “Hellooo?!?!! I said to pick an option from thoes displayed: 1,2,3,4,5,6 or 7″;
echo “Hit enter to resume. . .” ; read ;;
esac
done
Don’t forget to give the shell permission to execute your script:
chmod 755 the_script.sh


























The Discussion
see what everyone is saying
[...] Simple shell script http://www.etuts.resourcesit.com/2009/09/29/simple-shell-script/ [...]
Zubao0 That’s really thinking out of the box. Thanks!