From ddc6d336faa0901fd33cf9de30daaf670c53d68b Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Fri, 29 Jul 2016 16:07:07 +0200 Subject: [PATCH] open_wrapper.sh: make the wrapper script POSIX shell compliant Running open_wrapper.sh was failing with some shells different from bash, because they don't support substring expansion. For example, dash was giving this error: ./open_wrapper.sh: 35: ./open_wrapper.sh: Bad substitution While fixing the issue also use a stricter check for the URL: the anchor should only contain hex digits. --- open_wrapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/open_wrapper.sh b/open_wrapper.sh index 6a3d0d3..7f35ce8 100755 --- a/open_wrapper.sh +++ b/open_wrapper.sh @@ -32,7 +32,7 @@ decrypted_file() echo "${TEMPDIR}/${FILENAME}" } -if [ ${URL: -97:1} = "#" ]; +if echo -n "$URL" | grep -q '#[[:xdigit:]]\{96\}$'; then DESTINATION=$(decrypted_file "$URL") else -- 2.1.4