From 83af2d5cd74fb2f56ea91ab0b5331869a0dc0e49 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 25 Feb 2021 21:37:30 -0600 Subject: [PATCH] Disable shellcheck in usplit The local variables aren't picked up by shellcheck because of the printf level of indirection I do later in the function, which is the reason /why/ I use a variable in the first argument to printf. --- bollux | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bollux b/bollux index 2d206b1..d58aac3 100755 --- a/bollux +++ b/bollux @@ -223,11 +223,12 @@ usplit() { # usplit NAME:ARRAY URL:STRING local re='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?' [[ $2 =~ $re ]] || return $? - local scheme="${BASH_REMATCH[2]}" - local authority="${BASH_REMATCH[4]}" - local path="${BASH_REMATCH[5]}" - local query="${BASH_REMATCH[7]}" - local fragment="${BASH_REMATCH[9]}" + # shellcheck disable=2034 + local scheme="${BASH_REMATCH[2]}" \ + authority="${BASH_REMATCH[4]}" \ + path="${BASH_REMATCH[5]}" \ + query="${BASH_REMATCH[7]}" \ + fragment="${BASH_REMATCH[9]}" # 0=url 1=scheme 2=authority 3=path 4=query 5=fragment local i=1 c @@ -235,10 +236,12 @@ usplit() { # usplit NAME:ARRAY URL:STRING if [[ "${!c}" || "$c" == path ]]; then printf -v "$1[$i]" '%s' "${!c}" else + # shellcheck disable=2059 printf -v "$1[$i]" "$UC_BLANK" fi ((i += 1)) done + # shellcheck disable=2059 printf -v "$1[0]" "$(ujoin "$1")" # inefficient I'm sure } -- 2.20.1