Tutorial :Problems with ${(z)var}



Question:

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?


Solution:1

using ${(Q)${(z)RSYNCCMD}} might work for you (instead of ${(z)RSYNCCMD})

(${(z)RSYNCCMD} seems to be expanded to rsync -avP -e \"ssh\ -p\ 1234\", (Q) does an additional unquoting magic)


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »