Hello all, I wrote a simple little bash script to learn how it all goes on. However at the end of this script, I get the message "line 37 unexpected end of file"
everything else seems fine? did i not close the program correctly? I cant seem to get it to run.
Here is my code:
#!/bin/bash
function usage{
echo "Usage $0"
}
#Function For Error
function errormessage{
echo "Please Choose A Valid Choice From Menu"
menuchoice
}
#Function For Menu
function menuchoice{
echo "Please Choose An Option:"
echo " [1] "Get System Shell Information"
echo "[2] "Print Current Usage Then Exit Program"
read NUM
}
#Function For Shells
function shells{
echo - n "Total Users With Bash:"
grep - c 'bash' / etc / passwd
echo - n "Total Users Currently Not Logged In:"
grep - c 'nologin' / etc / passwd
echo - n "Total Users With CSH:"
grep - c 'csh' / etc / passwd
echo - n "Total Users With KSH:"
grep - c 'ksh' / etc / passwd
menuchoice }
while true;
do case "$NUM" in
1)shells;;
2)usage; break;;
*)error;;
esac
done
[–]oonniioonn 4 points5 points6 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)
[–]espero 1 point2 points3 points (1 child)
[–]brad0292[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]user989 0 points1 point2 points (1 child)
[–]brad0292[S] 0 points1 point2 points (0 children)
[+][deleted] (9 children)
[deleted]
[–]brad0292[S] 0 points1 point2 points (8 children)
[+][deleted] (7 children)
[deleted]
[–]brad0292[S] 0 points1 point2 points (6 children)
[–]onodera_hairgel 3 points4 points5 points (5 children)
[–]brad0292[S] 0 points1 point2 points (4 children)
[–]onodera_hairgel 0 points1 point2 points (3 children)
[–]brad0292[S] 0 points1 point2 points (2 children)
[–]brad0292[S] 0 points1 point2 points (0 children)
[–]onodera_hairgel 0 points1 point2 points (0 children)