Ok i have taken your advised indented my code and i have managed to fix my problem but unfortuantely now another small one has arisen.
The problem is that executing my commands requires two presses of the ENTER key as opposed to the originally being pressed once as one would expect, for example when quitting the program you are asked "Are you sure you want to quit?" after pressing Y you then have to press enter twice before the program is closed whereas before i was once you would expect. My edited code has been included below:
Code:
#!/bin/bash
#Filename: Assigntest Author: Luke Francis
quit=n
while [ "$quit" = "n" ]
do
clear
echo "OPERATOR ADMINISTRATIVE TOOL"
echo "1. User Information"
echo "2. Network Connectivity"
echo "3. Processes"
echo "4. System Information"
echo "5. Hardware Utilization"
echo "Q. Quit"
echo
echo "Which option do you require?"
read menunumber
case $menunumber in
1)clear
echo "USER INFORMATION"
echo "1. Registered Users"
echo "2. Disk Usage"
echo "3. Last Logins"
echo "4. Users Currently Logged In"
echo "5. Total number of users"
echo "Q. Quit"
echo "Which option do you require?"
read menunumber2
case $menunumber2 in
1)clear
echo "The users registered on the system are:"
echo
awk -F: '{print $1}' /etc/passwd
echo
echo "Hit the Enter Key to continue"
read junk;;
2)clear
echo "Disk Usage is as follows:"
echo
du
echo
echo "Hit Enter Key to continue"
read junk;;
3)clear
echo "Information on last noted login can be found next to each username."
echo
last
echo
echo "Hit Enter Key to continue"
read junk;;
4)clear
echo "Users currently logged in are:"
echo
w
echo
echo "Hit Enter Key to continue"
read junk;;
5)clear
echo "The total number of users are:"
echo
who -q
echo
echo "Hit Enter Key to continue"
read junk;;
Q|q)clear
echo "Are you sure you want to quit? Y/N"
read choice1
case $choice1 in
N|n)clear
echo "Hit Enter Key to continue"
read junk;;
Y|y)quit=y;;
*)clear
sleep 1;;
esac
;;
esac
;;
Q|q)clear
echo "Are you sure you want to quit? Y/N"
read choice2
case $choice2 in
N|n)clear
echo "Hit Enter key to continue"
read junk;;
Y|y)quit=y;;
*)clear
sleep 2;;
esac
;;
esac
read menunumber3
case $menunumber3 in
2)clear
echo "NETWORK CONNECTIVITY"
echo
echo "1. NIC Status"
echo "2. Machine Availability"
echo
echo "Which option do you require?"
read menunumber4
case $menunumber4 in
1)clear
echo "Information reagrding NIC status can be found below:"
echo
/sbin/ifconfig
echo
echo "Hit the Enter Key to continue"
read junk;;
2) clear
echo "Available hosts and addresses are shown below:"
echo
cat /etc/hosts
echo
echo "Hit Enter Key to continue"
read junk;;
esac
esac
done
clear
echo "Thank you for using the Operator Administrative Tool"
I hope you can understand what i am trying to get across, if not just say so i can explain. Also if possible could you please add any ammendmants recommended into the code i have supplied so i know exactly where to place them. Thanks alot for your help.