commit 70fdfbd45d27d06fc1b0fbbb9869060d3b2a2363
parent 123df34f27c112b2bd73b2864c4aa917e80d1874
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 26 Nov 2019 11:27:29 +0100
Add --user option to syncdir
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.local/bin/syncdir b/.local/bin/syncdir
@@ -2,6 +2,7 @@
set -e
version=0.1
+user=$USER
host=iddqd
show_help() {
@@ -12,6 +13,7 @@ show_help() {
echo " -h, --help show this message"
echo " -v, --version show version and license information"
echo " -H, --host VALUE use specified host instead of default ($host)"
+ echo " -U, --user VALUE use specified user instead of default ($USER)"
echo " -- do not consider any following args as options"
}
@@ -29,10 +31,10 @@ die() {
sync_dir() {
echo "syncing $1 to $host"
- rsync --update -rav --progress -e "ssh" "$1/" "$host":"$1/"
+ rsync --update -rav --progress -e "ssh" "$1/" "$user@$host":"$1/"
echo "syncing $host to $1"
- rsync --update -rav --progress -e "ssh" "$host":"$1/" "$1/"
+ rsync --update -rav --progress -e "ssh" "$user@$host":"$1/" "$1/"
}
while :; do