Quote:
Originally Posted by colucix
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).