upd (878B)
1 #!/bin/sh 2 3 # FIXME: trim random symbols 4 case $1 in 5 www) src="${HOME}/src/margiolis.net/" 6 dst="master@margiolis.net:/var/www/htdocs/margiolis.net" 7 ;; 8 ftp) src="${2}" 9 dst="master@margiolis.net:/var/www/htdocs/ftp.margiolis.net/${3}" 10 ;; 11 vps) src="${2}" 12 dst="master@margiolis.net:${3}" 13 ;; 14 lap) src="${2}" 15 dst="tpad:${3}" 16 ;; 17 desk) src="${2}" 18 dst="pleb:${3}" 19 ;; 20 old) src="${2}" 21 dst="old:${3}" 22 ;; 23 foo) src="${2}" 24 dst="foo:${3}" 25 ;; 26 # add disk, storage, all 27 *) echo "usage: ${0##*/} {www | ftp | vps | lap | desk | old | foo} src dst" 1>&2 && exit 1 ;; 28 esac 29 test -z "${src}" && echo "${0##*/}: src is empty" 1>&2 && exit 1 30 test -z "${dst}" && echo "${0##*/}: dest is empty" 1>&2 && exit 1 31 32 # add directory error check 33 read -erp "${0##*/}: transfer '${src}' to '${dst}' (y/N)? " act 34 test "${act}" = "y" && rsync -Purv --delete-after "${src}" "${dst}"