LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 06-17-2011, 01:16 PM   #16
RyuuzakiMasato7
LQ Newbie
 
Registered: Jun 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled

Ok, ran it with the -x added in, this is what it gives me:

Code:
+ backup=B
+restore=R
+exit=E
+ echo 'To backup the backups folder, type B and press enter.'
To backup the backups folder, type B and press enter.
+ echo 'To restore the backup, type R and press enter.'
To restore the backup, type R and press enter.
+ echo 'To exit, type E and press enter.'
To exit, type E and press enter.
+ read entry
B
So it gets to my entry, then just gives me that error straight away. Still completely lost ><
 
Old 06-17-2011, 02:22 PM   #17
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 1,319

Rep: Reputation: 252Reputation: 252Reputation: 252
Then I would proceed by making a copy of the script and remove some lines near the beginning and check whether the error persists. This way we can narrow it to a single line maybe.
 
Old 06-19-2011, 12:30 AM   #18
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,528
Blog Entries: 27

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by colucix View Post
Indeed it looks right. Every double quote pair is perfectly matched. I really don't know what happens.
Yes -- it looks OK and when I copy it from this thread, paste into an editor, change the /home/Rory paths to /tmp, save, make executable and run then it runs OK.

What that suggests is that there is something in the file that is lost in the copy and pasting, probably in Rory's copy and pasting to LQ.

Here's a dump of the script from this post as created on my system
Code:
c@CW8:/tmp$ od -tc script.sh 
0000000   #   !   /   b   i   n   /   s   h  \n  \n   b   a   c   k   u
0000020   p   =   "   B   "  \n   r   e   s   t   o   r   e   =   "   R
0000040   "  \n   e   x   i   t   =   "   E   "  \n  \n   e   c   h   o
0000060       "   T   o       b   a   c   k   u   p       t   h   e    
0000100   b   a   c   k   u   p   s       f   o   l   d   e   r   ,    
0000120   t   y   p   e       B       a   n   d       p   r   e   s   s
0000140       E   n   t   e   r   .   "  \n   e   c   h   o       "   T
0000160   o       r   e   s   t   o   r   e       t   h   e       b   a
0000200   c   k   u   p   ,       t   y   p   e       R       a   n   d
0000220       p   r   e   s   s       E   n   t   e   r   .   "  \n   e
0000240   c   h   o       "   T   o       e   x   i   t   ,       t   y
0000260   p   e       E       a   n   d       p   r   e   s   s       E
0000300   n   t   e   r   .   "  \n  \n   r   e   a   d       e   n   t
0000320   r   y  \n  \n   i   f       [   [       "   $   e   n   t   r
0000340   y   "       =   =       "   $   b   a   c   k   u   p   "    
0000360   ]   ]  \n   t   h   e   n      \n  \n           t   a   r    
0000400   z   c       /   h   o   m   e   /   R   o   r   y   /   b   a
0000420   c   k   u   p   s       -   f       /   h   o   m   e   /   R
0000440   o   r   y   /   a   r   c   h   i   v   e   /   R   o   r   y
0000460   -   `   d   a   t   e       +   %   d   %   m   %   y   `   .
0000500   t   a   r   .   g   z      \n  \n           e   c   h   o    
0000520   "   B   a   c   k   u   p       c   o   m   p   l   e   t   e
0000540   .   "  \n           e   c   h   o       "   T   o       b   a
0000560   c   k   u   p       t   h   e       b   a   c   k   u   p   s
0000600       f   o   l   d   e   r   ,       t   y   p   e       B    
0000620   a   n   d       p   r   e   s   s       E   n   t   e   r   .
0000640   "  \n           e   c   h   o       "   T   o       r   e   s
0000660   t   o   r   e       t   h   e       b   a   c   k   u   p   ,
0000700       t   y   p   e       R       a   n   d       p   r   e   s
0000720   s       E   n   t   e   r   .   "  \n           e   c   h   o
0000740       "   T   o       e   x   i   t   ,       t   y   p   e    
0000760   E       a   n   d       p   r   e   s   s       E   n   t   e
0001000   r   .   "   ;  \n  \n   f   i  \n  \n   r   e   a   d       e
0001020   n   t   r   y  \n  \n   i   f       [   [       "   $   e   n
0001040   t   r   y   "       =   =       "   $   r   e   s   t   o   r
0001060   e   "       ]   ]  \n   t   h   e   n  \n  \n           t   a
0001100   r       -   x   v   w   z   f       R   o   r   y   -   `   d
0001120   a   t   e       +   %   d   %   m   %   y   `   .   t   a   r
0001140   .   g   z  \n  \n           e   c   h   o       "   R   e   s
0001160   t   o   r   e       c   o   m   p   l   e   t   e   .   "  \n
0001200           e   c   h   o       "   T   o       b   a   c   k   u
0001220   p       t   h   e       b   a   c   k   u   p   s       f   o
0001240   l   d   e   r   ,       t   y   p   e       B       a   n   d
0001260       p   r   e   s   s       E   n   t   e   r   .   "  \n    
0001300       e   c   h   o       "   T   o       r   e   s   t   o   r
0001320   e       t   h   e       b   a   c   k   u   p   ,       t   y
0001340   p   e       R       a   n   d       p   r   e   s   s       E
0001360   n   t   e   r   .   "  \n           e   c   h   o       "   T
0001400   o       e   x   i   t   ,       t   y   p   e       E       a
0001420   n   d       p   r   e   s   s       E   n   t   e   r   .   "
0001440  \n  \n   f   i  \n  \n   r   e   a   d       e   n   t   r   y
0001460  \n  \n   i   f       [   [       "   $   e   n   t   r   y   "
0001500       =   =       "   $   e   x   i   t   "       ]   ]  \n   t
0001520   h   e   n  \n           e   x   i   t  \n   e   l   s   e  \n
0001540           e   c   h   o       "   I   n   v   a   l   i   d    
0001560   e   n   t   r   y   .       P   l   e   a   s   e       t   y
0001600   p   e       B   ,       R       o   r       E   .   "  \n    
0001620       r   e   a   d       e   n   t   r   y  \n   f   i  \n
0001637
Rory, you can copy that into a file and the run the same command on your own script with output sent to another file (using something like > od.out 2>&1 ) and then run diff on the two files. Alternatively you could post your script in this thread as an attachment (you might have to change any extension to .txt to fit with LQ's attachment rules).
 
Old 06-20-2011, 09:28 AM   #19
RyuuzakiMasato7
LQ Newbie
 
Registered: Jun 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
I got it! It turns out, idiot that I am, that I managed to leave a quotation mark at the end of a line, but the line was too long for my console to display so I kept missing it. It was just after the .tar.gz here:

Code:
tar zc /home/Rory/backups -f /home/Rory/archive/Rory-`date+%d%m%y`.tar.gz"; then
Thank you all so much for the help, and I'm sorry that my noob-ness dragged this on longer than it should have been ><'
 
  


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
./script.sh: line 2: syntax error near unexpected token `(' n00balert Programming 3 03-11-2010 04:22 PM
syntax error near unexpected token "fi" phillip58 Programming 3 07-05-2009 01:00 PM
syntax error unexpected token near "then" pclimmex Linux - Newbie 1 06-20-2008 10:51 PM
Backup Script error "line 31: syntax error: unexpected end of file" eswanepoel General 7 12-07-2007 09:28 AM


All times are GMT -5. The time now is 04:50 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration