Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: snytax error on line 29 " ;; &

Original Message
Name: macree
Date: May 3, 2008 at 11:01:08 Pacific
Subject: snytax error on line 29 " ;; &
OS: window xp
CPU/Ram: 512MB
Model/Manufacturer: dell
Comment:
#!/bin/ksh
while :
do
clear
cat <<++
MAIN MENU

1) Delete a file
2) Rename a file
3) Find a file
4) Display contents of a file using cat
5) Edit a file using vi
6) List the contents of a directory
7) Print current directory
8) Print today's date and time
x) Exit
++
echo "Please enter your selecton $LOGNAME \c
read selection
case $selection in
1)
echo "Enter a filename: \c
read fname
if [ -r $fname ]
then
rm $fname
else
echo " menu: Cannot access file $fname"
fi
;;
2)
echo "Enter a filename: \c"
read fname
echo "Enter a new filename \c"
read frename
if [ -r $fn ]
then
cp $fname $frename
else
echo "menu: Cannot access file $fname"
fi
;;
3)
echo "Enter a filename: \c
read fname
find . -name "$fname" -print
;;
4)
echo "Enter a filename: \c
read fname
if [ -r $fname ]
then
cat $fname
else
echo "menu: Cannot access the $fname \c"
fi
;;
5)
echo "Enter a filename: \c"
read fname
if [ -r $fname ]
then
vi $fname
else
echo "menu: Cannot access the file $fname \c"
6)
echo "Enter a directory name \c"
read dname
if [ -r $dname ]
then
ls -l $dname
else
echo "menu: Cannot access directory $dname"
fi
;;
7)
pwd
;;
8)
date
;;
q|Q|e|ExX
exit 0
;;
*) echo "Invalid choice, Try again. ";;
esac
echo "Press enter to continue \c"
done

macree_37


Report Offensive Message For Removal

Response Number 1
Name: nails
Date: May 3, 2008 at 22:05:06 Pacific
Subject: snytax error on line 29 " ;; &
Reply: (edit)
A)
At line 17, you forgot a terminating double quote:

echo "Please enter your selecton $LOGNAME \c

same with lines 21, 43, 48

B)
about line 65, you are missing a terminater for the if statement and the case clause. this should be:

read fname
if [ -r $fname ]
then
vi $fname
else
echo "menu: Cannot access the file $fname \c"
6)

This:

read fname
if [ -r $fname ]
then
vi $fname
else
echo "menu: Cannot access the file $fname \c"
fi
;;
6)

C) Finally, lose the ;; semicolon below. This:

8)
date
;;
q|Q|e|ExX
exit 0
;;

should be:

8)
date
q|Q|e|ExX
exit 0
;;



Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: snytax error on line 29 " ;; &

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC