Amos Shapira wrote:
2008/12/5 guy keren <[EMAIL PROTECTED]>:
there are certain constructs of quoting that you simply cannot do with a
shell.

put your 'ssh -i /root/rsync.id' command in a script file, and supply the
script file in the '-e' flag of rsync.

Yes I though about that - but it's very ugly, especially if it's a
side-script and the operation has to be repeated from different
scripts.

you may also pus the 'ssh -i ...' in a shell function - it'll work just the
same.

Though about this too but this all started when the "ssh..." part was
in its own variable (for easier configurability), so I'm not sure
it'll help with the quoting.

Someone else off list suggested "eval" - just putting "eval" in front
of the "rsync" call made things work as I wanted :).

this is a great way to write "write-only" code. often-times, the simple solution, even if it is uglier, is the one that'll be easier to maintain later on.

and regarding the function - this is completely different from using a variable - because of the way the shell performs its expansion work. the main problem is that the shell works in a non-recursive expansion order (i.e. it knows how to expand 7 or 8 things, but it always expands them in the same order). this is most likely why an extra eval helped - it causes the shell to expand everything twice. unfortunately, those evals sometimes add other side effects that break the expression, and they cause code to be un-maintainable.

but of-course, it's up to you to decide what solution is more suitable for you.

--guy


Thanks,

--Amos

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to