Computer Hope

Software => BSD, Linux, and Unix => Topic started by: erinprime on August 16, 2015, 12:18:16 PM

Title: Unexpected end of file error
Post by: erinprime on August 16, 2015, 12:18:16 PM
I can see two simple syntax errors that I need to correct, but my big question is why do I have an unexpected end of file error? I was able to use this scrips to end a different program:

#!/bin/bash
until [ "$userIn" = "j" ]
or main menu
do
echo "Command Menu"
echo
echo "a. Emailer Program"
echo "b. Users Currently Logged On"
echo "c. Current Date and Time"
echo "d. This Months Calendar"
echo "e. Name of the Current Working Directory"
echo "f Contents of the Working Directory"
echo "g. Find the IP of a Web address"
echo "h. See your Fortune"
echo "i. Print a File on the Screen"
echo "j. Exit"
echo
echo -n "Please select a letter: "
case "$userIn" in
a|A) echo
echo "This program will allow you to send an email,"
echo "with file attached."
echo
echo -n "Please enter the subject of yout message: "
read userMessage
echo
echo -n "Please enter the email address: "
read userAddress
echo
echo -n "Please enter the file to attach: "
read emailFile
mail -s "$userMessage" "$userAddress"<"$emailFile"
echo
;;
b|B) echo
echo "This menu selection shows who is currently logged on";

echo "which is: "
echo
who
echo
;;
c|C) echo
echo "This menu selection gives the current date and time;"

echo "which is: "
echo
date
echo
;;
d|D) echo
echo "This menu selection shows the current months calendar"
echo "which is: "
echo
cal
echo
;;
e|E) echo
echo "This selection shows the current working directory"
echo "which is: "
echo
pwd

echo
;;
f|F) echo
echo "This menu selection shows the contents of the current working directory"
echo "working directory; which is: "
echo
ls
echo
;;
g|G) echo
echo "This menu selection looks up an IP address using a web address"
echo
echo -n "Please Enter the Web Address to Look Up: "
read userAddress
echo
host "$ userAddress"
echo
;;
h|H) echo
echo "This menu selection outputs one of many fortunes. "
echo
fortune
echo
;;
i|I) echo
echo
echo "This menu selection outputs a chosen file to print on the screen"
echo "page by page if it is a large file. "
echo
echo -n "Please Enter a File to See: "
read userFile
echo
if [ -f "$userFile" ]

then
more "$userFile"
else
echo "The file is invalid or cannot be found. "
fi
echo
;;
j|J) echo
echo "Thank you for trying this program"
echo
;;
esac