Can using vi in runlevel 3 then runlevel 5 cause syntax errors?
Hello
Here's my problem
I am using RHEL5 Server on an i686 machine in runlevel 3
Creating a bash script using vi
Running the script in vi as I go, to iron out any problems
I startx to get a print of what I've done so far, I like to see the highlighting
I carry on writiing my script in vi in the gui, and start getting syntax errors
That was previously error free
I hashed out the line with the errors and the while loop but it makes no difference
If I hash out the offending last line, how can I get an error in that line?
I should probably include the script
Its basically a case statement in a while loop
#!/bin/bash
#
# A script for the VTC shell scripting course
###################################################
#
# The VTC Database
#
#####################################################
#
# Define the name of the file
#
fname=names.txt
#
#
# If this file does not exist create it
#
[ ! -f $fname ] && > $fname
#
# Start a forever loop
#
while true
do
#
# Present the user with a list of options
#
clear
echo WELCOME TO THE VTC DATABASE
echo
echo Please select one of the following options:
echo
echo 1. Create a record
echo 2. View records
echo 3. Search for records
echo 4. Delete records that match a pattern
echo
echo -n Enter number or type q to quit ?
read choice junk
#
#
# Empty answers cause menu to redisplay
#
[ "$choice = "" ] && continue
#
# The options are constructed as a case statement
#
case $choice in
#
#
# Option 1. Create a record
#
#
1)
echo
echo WELCOME TO THE VTC DATABASE
echo
echo "Please enter the following details: "
echo
echo -n "First Name: " ;read name
echo -n " Surname: " ;read sur
echo -n " Address: " ;read add
echo -n " Borough: " ;read boro
echo -n " City: " ;read city
echo -n " Postcode: " ;read post # line 67
#
# Send the above details to names.txt
#
echo
echo $name:$sur:$add:$boro:$city:$post >> $fname
;;
#
#
#####################################################
#
# Option 2. View records
#
2)
echo
echo These are the contents of the VTC Database
echo
cat $fname | more
#
# Display the number of entries
#
echo
echo There are `wc -l < $fname` entries in the VTC Database
;;
#
#
#######################################################
3)
echo This option is not implemented yet
;;
4)
echo This option is not implemented yet
;;
q*|Q*)
exit 0
;;
*)
echo Please try again
;;
esac
done # line 110
The errors I get are as follows
line 67: unexpected EOF while looking for matching `"'
line 110: syntax error: unexpected end of file
If the problem is with the script thats ok
My question is,
Can a change like, I have described above cause syntax errors that you can't see?
Thanks
|