shellcheck complains a lot about rad.sh
shellcheck (https://www.shellcheck.net/) is a popular tool for checking Unix shell scripts for common problems, such as undefined variables. It has much to say about rad.sh: output is below. (If you’d like help fixing these things, let me know. I’ve done that a fair bit over the years.)
In rad.sh line 3:
local op=$(echo $1 | jq '.operation')
^-- SC2155 (warning): Declare and assign separately to avoid masking return values.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
local op=$(echo "$1" | jq '.operation')
In rad.sh line 10:
local ids=$(echo $1 | jq '.ids')
^-^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
local ids=$(echo "$1" | jq '.ids')
In rad.sh line 11:
local id=$(echo $ids | jq '.[0]')
^-- SC2155 (warning): Declare and assign separately to avoid masking return values.
^--^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
local id=$(echo "$ids" | jq '.[0]')
In rad.sh line 21:
{ out=$(rad-tui $1 select 2>&1 >&3 3>&-); } 3>&1
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
{ out=$(rad-tui "$1" select 2>&1 >&3 3>&-); } 3>&1
In rad.sh line 26:
op=$(extract_operation $out)
^--^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
op=$(extract_operation "$out")
In rad.sh line 27:
id=$(extract_id $out)
^--^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
id=$(extract_id "$out")
In rad.sh line 29:
rad $1 $op $id
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
^-^ SC2086 (info): Double quote to prevent globbing and word splitting.
^-^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
rad "$1" "$op" "$id"
In rad.sh line 33:
{ out=$(rad-tui $1 select $args 2>&1 >&3 3>&-); } 3>&1
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
^---^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
{ out=$(rad-tui "$1" select "$args" 2>&1 >&3 3>&-); } 3>&1
In rad.sh line 34:
id=$(extract_id $out)
^--^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
id=$(extract_id "$out")
In rad.sh line 38:
rad $1 $2 $id ${args[@]:2}
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
^-^ SC2086 (info): Double quote to prevent globbing and word splitting.
^----------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements.
Did you mean:
rad "$1" "$2" "$id" ${args[@]:2}
In rad.sh line 41:
rad $@
^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements.
In rad.sh line 44:
rad $@
^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements.
For more information:
https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ...
https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
Solved by removing
rad.sh