From f4ae5a6e5c711430f64001cff0ffb2711f4ee912 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 10 Jul 2003 17:51:07 +0000 Subject: Handle files with spaces (although that pescy rsync doesn't cope with them anyhow :-( ). --- localsyncthis | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'localsyncthis') diff --git a/localsyncthis b/localsyncthis index c5ec4e4..680f0c9 100755 --- a/localsyncthis +++ b/localsyncthis @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -x set -e @@ -72,26 +72,24 @@ if [ -z $hosts ]; then exit 1 fi -if [ "x$1" = "x" ]; then - workdirs=`pwd` +if [ -z "$1" ]; then + workdir="`pwd`" localdir='' -else - workdirs=$@ - fi +fi -for workdir in $workdirs; do +while [ -n "$workdir" ]; do for host in $hosts; do - here="$localdir$workdir" - there="$host:$remotedir$workdir" + thisdir="$localdir$workdir" + thatdir="$remotedir$workdir" case $action in download) - rsync --rsh="ssh $ssh_opts" $rsync_opts $there/ $here - [ $V ] && echo rsync --rsh="ssh $ssh_opts" $rsync_opts $there/ $here + rsync --rsh="ssh $ssh_opts" $rsync_opts "$host:'$thatdir/'" "'$thisdir'" + [ $V ] && echo rsync --rsh="ssh $ssh_opts" $rsync_opts "$host:'$thatdir/'" "'$thisdir'" ;; upload) - rsync --rsh="ssh $ssh_opts" $rsync_opts $here/ $there - [ $V ] && echo rsync --rsh="ssh $ssh_opts" $rsync_opts $here/ $there + rsync --rsh="ssh $ssh_opts" $rsync_opts "'$thisdir/'" "$host:'$thatdir'" + [ $V ] && echo rsync --rsh="ssh $ssh_opts" $rsync_opts "'$thisdir/'" "$host:'$thatdir'" ;; *) echo "$prg error: You need to specify either --upload or --download!" echo @@ -100,6 +98,8 @@ for workdir in $workdirs; do ;; esac done + $workdir="$1" + [ -n "$1" ] && shift done exit 0 -- cgit v1.2.3