sharefile

scripts for quickly sharing data to servers
git clone git://jb55.com/sharefile
Log | Files | Refs | README

commit 8a8e9f55ec2f492230cfabe35d147e8beb676a67
parent 80f710499cdf1d829cbaa12801f60b22a4696dcb
Author: William Casarin <bill@casarin.me>
Date:   Wed, 24 Jun 2015 18:27:11 -0700

fix wonkyness

Diffstat:
Msharefile | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/sharefile b/sharefile @@ -2,6 +2,10 @@ set -e +urlencode() { + perl '-MURI::Escape' -e 'print uri_escape($ARGV[0]);' "$1" +} + name="" errord=0 OPTIND=1 @@ -47,10 +51,11 @@ file="$1" [[ -z $SHAREFILE_HOST ]] && missing_env "SHAREFILE_HOST, eg: me.com:public/files/" [[ -z $SHAREFILE_URL ]] && missing_env "SHAREFILE_URL, eg: http://me.com/files/" -[[ -z $file ]] && show_help +[[ -z "$file" ]] && show_help + +name="${name:-"$(basename "$file")"}" +dest="${SHAREFILE_HOST}\"${name}\"" -name=${name:-$(basename "$file")} -dest="${SHAREFILE_HOST}${name}" +rsync -zq --chmod=a=r "$file" "$dest" -rsync -zq --chmod=a=r "$file" "$dest" -echo "${SHAREFILE_URL}${name}" +echo "${SHAREFILE_URL}$(urlencode "$(basename "${file}")")"