Code:
HOST=localhost
PORT=1234
RSYNCCMD="rsync -avP -e \"ssh -p $PORT\""
${(z)RSYNCCMD} root@$HOST:"\"/foo\"" /bar
Output:
rsync: Failed to exec ssh -p 1234: No such file or directory (2)
...
If I enter the same thing (rsync -avP -e "ssh -p 1234" ...) directly into the console, it works.
How do I fix it?
using
${(Q)${(z)RSYNCCMD}}might work for you (instead of${(z)RSYNCCMD})(
${(z)RSYNCCMD}seems to be expanded torsync -avP -e \"ssh\ -p\ 1234\", (Q) does an additional unquoting magic)