Re: Shellscript escaping problem

2012-08-05 Thread David Diggles
On Fri, Aug 03, 2012 at 10:41:09PM -0700, Philip Guenther wrote: On Fri, Aug 3, 2012 at 9:35 PM, David Diggles da...@elven.com.au wrote: ... here's an example of how not to script rsync, when just starting to learn how to script it got over complicated over time. i should rewrite it

Re: Shellscript escaping problem

2012-08-05 Thread Philip Guenther
On Sat, Aug 4, 2012 at 11:00 PM, David Diggles da...@elven.com.au wrote: What is wrong with an example of how bad spaghetti scripting looks like? I think there can be value in seeing an exagerrated example of what not to do. I don't think it's obvious to everyone that that was bad code. Indeed,

Re: Shellscript escaping problem

2012-08-04 Thread Martijn Rijkeboer
If you're doing complex rsync setups, you might also consider using rsnapshot as a wrapper. I just joined the maintainer list on that, it's a very useful old perl tool, well organized for frequent and well managed backups. Rsnapshot is a nice tool, but for my current usage rsync suffices.

Re: Shellscript escaping problem

2012-08-04 Thread Alexander Hall
Philip Guenther guent...@gmail.com wrote: On Fri, Aug 3, 2012 at 9:35 PM, David Diggles da...@elven.com.au wrote: ... here's an example of how not to script rsync, when just starting to learn how to script it got over complicated over time. i should rewrite it sometime :) ... I guess I

Re: Shellscript escaping problem

2012-08-03 Thread Martijn Rijkeboer
RSYNC_CMD=/usr/local/bin/rsync -v -n \ --rsync-path='rsync sudo' \ This doesn't do what you think it does. The single quotes are getting literally passed to rsync, they're not reinterpreted after $RSYNC_CMD is interpolated. Yep. $RSYNC_CMD will be splitted by space, tab or newline by

Re: Shellscript escaping problem

2012-08-03 Thread Nico Kadel-Garcia
On Fri, Aug 3, 2012 at 4:10 AM, Martijn Rijkeboer mart...@bunix.org wrote: RSYNC_CMD=/usr/local/bin/rsync -v -n \ --rsync-path='rsync sudo' \ This doesn't do what you think it does. The single quotes are getting literally passed to rsync, they're not reinterpreted after $RSYNC_CMD is

Re: Shellscript escaping problem

2012-08-03 Thread David Diggles
On Thu, Aug 02, 2012 at 11:21:01PM +0200, Martijn Rijkeboer wrote: Hi, here's an example of how not to script rsync, when just starting to learn how to script it got over complicated over time. i should rewrite it sometime :) #!/bin/bash SCRIPT=${0##*/} BASE=/archive0/_backup SSHOPTS=-q -o

Re: Shellscript escaping problem

2012-08-03 Thread Philip Guenther
On Fri, Aug 3, 2012 at 9:35 PM, David Diggles da...@elven.com.au wrote: ... here's an example of how not to script rsync, when just starting to learn how to script it got over complicated over time. i should rewrite it sometime :) ... I guess I don't understand the point of sending that out.

Shellscript escaping problem

2012-08-02 Thread Martijn Rijkeboer
Hi, I'm using the script below and it keeps giving me the following error: Unexpected remote arg: backup@fqdn:/data/dir/ rsync error: syntax or usage error (code 1) at main.c(1214) [sender=3.0.9] It looks like something is going wrong with my escaping, because when I remove the --rsync-path

Re: Shellscript escaping problem

2012-08-02 Thread Matthew Dempsky
On Thu, Aug 2, 2012 at 2:21 PM, Martijn Rijkeboer mart...@bunix.org wrote: RSYNC_CMD=/usr/local/bin/rsync -v -n \ --rsync-path='rsync sudo' \ This doesn't do what you think it does. The single quotes are getting literally passed to rsync, they're not reinterpreted after $RSYNC_CMD is

Re: Shellscript escaping problem

2012-08-02 Thread Alexander Hall
On 08/02/12 23:34, Matthew Dempsky wrote: On Thu, Aug 2, 2012 at 2:21 PM, Martijn Rijkeboer mart...@bunix.org wrote: RSYNC_CMD=/usr/local/bin/rsync -v -n \ --rsync-path='rsync sudo' \ This doesn't do what you think it does. The single quotes are getting literally passed to rsync,