Amos Shapira wrote:
2008/12/5 guy keren <[EMAIL PROTECTED]>:
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.
I think the external-script solution is uglier because it's yet
another file to keep track of in a heap of scripts and config files.
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.
Can you give a full example of how would you rewrite the sample code
to use a shell function instead of eval?
Code maintainability is very important to me.
i don't have how to test this now, but basically, i would try to write a
shell function named 'blabla', which contains a single line of code -
ssh -i /root/rsync.id
and supply the name of this function to the '-e' flag of rsync - and see
if this works. i'm not sure it will - but you can still try this.
if this does work - you may place the definition of this function just
above the rsync line - and you won't have to use an extra file.
--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]