From da57b6764606cea347c135771f46c6cd88b63a45 Mon Sep 17 00:00:00 2001 From: Till Höppner Date: Sat, 20 May 2017 04:11:48 +0200 Subject: Strip names of file extension --- conf.d/99-pastebin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'conf.d/99-pastebin.zsh') diff --git a/conf.d/99-pastebin.zsh b/conf.d/99-pastebin.zsh index 7e64c8b..42a72cd 100644 --- a/conf.d/99-pastebin.zsh +++ b/conf.d/99-pastebin.zsh @@ -17,7 +17,8 @@ function pbupload() { res=$(curl $PB_CURL_ARGS -sF "c=@$1" "https://$PB_INSTANCE$PB_URL_PATH") fi - local name=$(awk '/url/ { print $2 }' <<<"$res" | tr -d '\n' | sed 's@.*://.*/\(.*\)@\1@') + local full_name=$(awk '/url/ { print $2 }' <<<"$res" | tr -d '\n' | sed 's@.*://.*/\(.*\)@\1@') + local name="${full_name%%.*}" if [ -z "$name" ]; then echo "$res" 1>&2 exit 1 -- cgit v1.2.3