Hi, came across this rather baffling behaviour today while writing a script:
Code:
steve@machn ~ $ echo $flags
steve@machn ~ $ flags="-r"
steve@machn ~ $ echo $flags
-r
steve@machn ~ $ flags="-r -e"
steve@machn ~ $ echo $flags
-r -e
steve@machn ~ $ flags="-e"
steve@machn ~ $ echo $flags
steve@machn ~ $
Even more bafflingly something seems to insert stray single-quotes in this line:
Code:
flags="-e \"ssh -p $port\""
so that it becomes (according to bash -x)
Code:
+ rsync -e '"ssh' -p '65555"'
obviously screwing everything up.
What am i missing here?
Using GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)