LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-23-2004, 09:09 AM   #1
box_l
Member
 
Registered: Jul 2003
Location: Hereford,England
Distribution: mandrake 10 , Novell Desktop Linux (suse) , knoppix
Posts: 85

Rep: Reputation: 15
my script has no end of file!??


i have found a simple bash script and am trying to make it do things my way.
i have modified it quite a lot and,
i am obviously doing something wrong. can you help?

#!/bin/bash

clear

echo "##################################"
echo " Image menu"
echo "##################################"
echo ""
echo ""
echo "[1] Restore Image"
echo "[2] Restore ONLY C: Drive"
echo "[3] Create Image"
echo "[0] quit"
read input

case $input in

"1" )
echo "Please enter image name"
echo "[1] Dx2000mt"
echo "[2] D31v"
echo "[3] D230m"
echo "[4] D330m"


read input

case $input in

"a" )

img pd1
img pd2
img pd3
img pd4

hdparm -d1 /dev/hda

img 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp001.zmg

img pc2 ntfs
img pa1
img 10.1.80.3 //hct-cluster2/zenimages/images/xp/ddrive.zmg a11
reboot
break
;;

"b" )

img pd1
img pd2
img pd3
img pd4

hdparm -d1 /dev/hda

img 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp002.zmg

img pc2 ntfs
img pa1
img 10.1.80.3 //hct-cluster2/zenimages/images/xp/ddrive.zmg a11
reboot
break
;;
"c" )

img pd1
img pd2
img pd3
img pd4

hdparm -d1 /dev/hda

img 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

img pc2 ntfs
img pa1
img 10.1.80.3 //hct-cluster2/zenimages/images/xp/ddrive.zmg a11
reboot
break
;;
"d" )

img pd1
img pd2
img pd3
img pd4

hdparm -d1 /dev/hda

img 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp004.zmg

img pc2 ntfs
img pa1
img 10.1.80.3 //hct-cluster2/zenimages/images/xp/ddrive.zmg a11
reboot

break
;;
"2" )
echo "Please enter image name"
echo "[a] Dx2000mt"
echo "[b] D31v"
echo "[c] D230m"
echo "[d] D330m"


read input
case $input in
"a" )
hdparm -d1 /dev/hda

img rp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp001.zmg

reboot
break
;;

"b" )
hdparm -d1 /dev/hda

img rp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp002.zmg

reboot
break
;;
"c" )

hdparm -d1 /dev/hda

img rp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

reboot
break
;;

"d" )

hdparm -d1 /dev/hda

img rp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

reboot
break
;;
"3" )

echo "Please enter image name"
echo "[a] Dx2000mt"
echo "[b] D31v"
echo "[c] D230m"
echo "[d] D330m"


read input
case $input in
"a" )
hdparm -d1 /dev/hda

img mp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp001.zmg

reboot
break
;;

"b" )
hdparm -d1 /dev/hda

img mp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp002.zmg

reboot
break
;;
"c" )

hdparm -d1 /dev/hda

img mp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

reboot
break
;;

"d" )

hdparm -d1 /dev/hda

img mp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

reboot
break
;;

"0")
clear
ash -rcfile /bin/bashrc
break
;;

esac
done
exit 0


thanks in advance

BoX
 
Old 07-23-2004, 10:18 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
remove all your "break" as ";;" is for that
 
Old 07-26-2004, 04:19 AM   #3
box_l
Member
 
Registered: Jul 2003
Location: Hereford,England
Distribution: mandrake 10 , Novell Desktop Linux (suse) , knoppix
Posts: 85

Original Poster
Rep: Reputation: 15
@ keefaz, thanks.

now i get

/home/lawrenb/Desktop/ll: line 201: syntax error near unexpected token `done'
/home/lawrenb/Desktop/ll: line 201: `done'

#!/bin/bash
while [ "$input" != "0" ]
do
clear

echo "##################################"
echo " Image menu"
echo "##################################"
echo ""
echo ""
echo "[1] Restore Image"
echo "[2] DX2000 Restore ONLY C: Drive"
echo "[3] Create Image"
echo "[0] quit"
read input

case $input in

"1" )
echo "Please enter image name"
echo "[1] Dx2000mt"
echo "[2] D31v"
echo "[3] D230m"
echo "[4] D330m"


read input

case $input in

"a" )

img pd1
img pd2
img pd3
img pd4

hdparm -d1 /dev/hda

img 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp001.zmg

img pc2 ntfs
img pa1
img 10.1.80.3 //hct-cluster2/zenimages/images/xp/ddrive.zmg a11
reboot

;;

"b" )

img pd1
img pd2
img pd3
img pd4

hdparm -d1 /dev/hda

img 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp002.zmg

img pc2 ntfs
img pa1
img 10.1.80.3 //hct-cluster2/zenimages/images/xp/ddrive.zmg a11
reboot

;;
"c" )

img pd1
img pd2
img pd3
img pd4

hdparm -d1 /dev/hda

img 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

img pc2 ntfs
img pa1
img 10.1.80.3 //hct-cluster2/zenimages/images/xp/ddrive.zmg a11
reboot

;;
"d" )

img pd1
img pd2
img pd3
img pd4

hdparm -d1 /dev/hda

img 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp004.zmg

img pc2 ntfs
img pa1
img 10.1.80.3 //hct-cluster2/zenimages/images/xp/ddrive.zmg a11
reboot


;;
"2" )
echo "Please enter image name"
echo "[a] Dx2000mt"
echo "[b] D31v"
echo "[c] D230m"
echo "[d] D330m"


read input
case $input in
"a" )
hdparm -d1 /dev/hda

img rp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp001.zmg

reboot

;;

"b" )
hdparm -d1 /dev/hda

img rp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp002.zmg

reboot

;;
"c" )

hdparm -d1 /dev/hda

img rp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

reboot

;;

"d" )

hdparm -d1 /dev/hda

img rp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

reboot

;;
"3" )

echo "Please enter image name"
echo "[a] Dx2000mt"
echo "[b] D31v"
echo "[c] D230m"
echo "[d] D330m"


read input
case $input in
"a" )
hdparm -d1 /dev/hda

img mp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp001.zmg

reboot

;;

"b" )
hdparm -d1 /dev/hda

img mp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp002.zmg

reboot

;;
"c" )

hdparm -d1 /dev/hda

img mp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

reboot

;;

"d" )

hdparm -d1 /dev/hda

img mp 10.1.80.3 //hct-cluster2/zenimages/images/xp/xp-hp003.zmg

reboot

;;

"0")
clear
ash -rcfile /bin/bashrc

;;
esac
done
exit 0
 
Old 07-26-2004, 04:35 AM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
You have a ton of nested case statements, but you never terminate them with esac. You need an esac for each case statement you use.
 
Old 07-26-2004, 05:18 AM   #5
box_l
Member
 
Registered: Jul 2003
Location: Hereford,England
Distribution: mandrake 10 , Novell Desktop Linux (suse) , knoppix
Posts: 85

Original Poster
Rep: Reputation: 15
thank you loads!!



BoX
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
python cgi script and premature end of script headers Neruocomp Programming 1 07-28-2005 11:43 AM
/r at end of line in script silence Linux - General 1 08-21-2004 08:25 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM
Can I redirect script output to a file without ">> $LOGFILE" at the end of each line davee Linux - General 1 12-19-2003 05:01 AM
Script, Reading a file, When end of file? elibm Programming 2 07-16-2001 11:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration