summaryrefslogtreecommitdiff
path: root/localsyncthis
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2003-07-10 17:51:07 +0000
committerJonas Smedegaard <dr@jones.dk>2003-07-10 17:51:07 +0000
commitf4ae5a6e5c711430f64001cff0ffb2711f4ee912 (patch)
treeab227d5cdea4c2f2c69c5b7e861a56fad88d265b /localsyncthis
parentab644abb8d729bf10c304f701650facb1a776933 (diff)
Handle files with spaces (although that pescy rsync doesn't cope with them anyhow :-( ).
Diffstat (limited to 'localsyncthis')
-rwxr-xr-xlocalsyncthis26
1 files changed, 13 insertions, 13 deletions
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