From 478535b0c4fbb077ddd7f46a992176a211a666ce Mon Sep 17 00:00:00 2001 From: Chloe Kudryavtsev Date: Fri, 22 Mar 2019 01:22:25 -0400 Subject: [client] Update shell script/sourceable --- client/brpaste.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/brpaste.sh b/client/brpaste.sh index 97bd697..0e3dbce 100755 --- a/client/brpaste.sh +++ b/client/brpaste.sh @@ -1,8 +1,10 @@ #!/bin/sh brpaste() { host='https://brpaste.xyz' - out=$(curl -sF 'data=<-' $host || printf fail) - [ "$out" = fail ] && echo fail || printf '%s/%s\n' "$host" "$out" + [ $# -eq 0 ] && set -- '-' + brpaste_id=$(curl -#fF "data=<$1" "$host") \ + || { echo 'ERROR: Upload failed!' >&2 && exit 1; } + printf '%s/%s\n' "$host" "$brpaste_id" } -brpaste +return 0 2>/dev/null || brpaste "$@" -- cgit v1.2.3