commit a6f82f0590ce78aa9fd637f3004438fef37e0861 parent 3ba6a377d0294c9d8aa4a4e35f576af39097b0b4 Author: sin <sin@2f30.org> Date: Thu, 28 Nov 2013 13:37:12 +0000 Proper quoting, thanks dalias Diffstat:
M | itor | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/itor b/itor @@ -57,5 +57,8 @@ while read f; do ((idx=idx+1)) done < $listing -escapedfile=$(echo ${f// /\\ }) -rsync --partial --progress -av -e ssh $host:"$rdir/$escapedfile" "$ldir" +# Taken from: http://www.etalabs.net/sh_tricks.html +quote () { printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/" ; } + +quoted=$(quote "$rdir/$f") +rsync --partial --progress -av -e ssh $host:"$quoted" "$ldir"