summaryrefslogtreecommitdiff
path: root/localsyncthis
diff options
context:
space:
mode:
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