info.sh
Platform: Shell
Published Sep 02, 2011
Updated Sep 24, 2011
This is my first bash script.
This is a bash script which shows you some useful information.
Menu
[1] Show Todays date/time
[2] Shows directory
[3] Show system uptime
[4] Show system info
[5] Show account info
[6] Show online users
[7] Exit the menu
- Status -
This snippet is finished. #!/bin/bash
while :
do
clear
echo "-------------------------------------"
echo " info.sh - Main Menu - By Aha2Y "
echo "-------------------------------------"
echo "[1] Show Todays date/time"
echo "[2] Shows directory"
echo "[3] Show system uptime"
echo "[4] Show system info"
echo "[5] Show account info"
echo "[6] Show online users"
echo "[7] Exit/Stop"
echo "======================="
echo ""
echo -n "Enter your menu choice [1-7]: "
read input
case $input in
1)
echo "Today is `date` , press a key. . ." ; read ;;
2)
echo "Files in `pwd`" ; ls -l ; echo "Press a key. . ." ; read ;;
3)
uptime ; echo "Press a key. . ." ; read ;;
4)
FILE=sysinfo.pl
if [ -f $FILE ]; then
perl sysinfo.pl ;
else
wget http://kottnet.net/sysinfo.pl && perl sysinfo.pl ;
fi ; read ;;
5) echo ""
echo "--------------------------"
echo "User: $USER" ;
echo "Home: $HOME" ;
if [ $USER == "root" ] ; then
echo "Root: yes" ;
else
echo "Root: no"
fi ;
echo "OsType: $OSTYPE"
echo "--------------------------"
echo ""
echo "press a key. . ." ; read ;;
5) w ; read ;;
6) exit 0 ;;
*) echo "Please select a number.";
esac
done