From f4efa1cf173034d0db8c2b5eba81ad6726f92bdc Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 20 Mar 2019 04:46:46 +0000 Subject: [PATCH] etc/profile.d/functions --- etc/profile.d/functions | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 3ef254b4..a508fbe7 100755 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -287,14 +287,19 @@ END { } unzipurl() { + local usage="Usage: unzipurl URL [-q QUIET]" local url file - url=${1:?Usage: unzipurl URL} + url=${1:?$usage}; shift + verbose=1 + [ "$1" = "-q" ] && verbose=0 && shift + [ $# -gt 0 ] && echo "$usage" 1>&2 && return 1 + #echo OK $verbose; return -# NB 20.03.19 file=`echo "$url"|awk -F/ '/\.zip$/ { print $NF }'` -# NB 20.03.19 [ -z "$file" ] && file="unzipurl.zip" - - file="/tmp/unzipurl.$$.zip" + file=`echo "$url"|awk -F/ '/\.zip$/ { print $NF }'` + [ -z "$file" ] && file=".unzipurl.zip" +# NB 20.03.19 +# NB 20.03.19 file="/tmp/unzipurl.$$.zip" wget "$url" -O "$file" && unzip -v "$file" -- 2.47.3