Shellchecker lints
I ran shellchecker against the shell scripts in this repo, and it reported quite some issue. Most of them are however easily fixed. A MR will follow
Shellchecker Lints Basilisk
In bootstrap.sh line 3:
MID=$(ps -p $PPID -o ppid=| sed s/[^0-9]*//g)
^----^ SC3026 (warning): In POSIX sh, ^ in place of ! in glob bracket expressions is undefined.
In bootstrap.sh line 7:
if [ -f $NAME_FILE ]
^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -f "$NAME_FILE" ]
In bootstrap.sh line 9:
export NAME=$(cat $NAME_FILE)
^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^---------------^ SC2046 (warning): Quote this to prevent word splitting.
^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
export NAME=$(cat "$NAME_FILE")
In bootstrap.sh line 11:
export NAME=$(who am i|awk '{ print $5}')
^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^---------------------------^ SC2046 (warning): Quote this to prevent word splitting.
In close_stratumkey.sh line 2:
if [ -n "$(echo $SSH_CLIENT | grep '192\.168\.17')" ]
^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -n "$(echo "$SSH_CLIENT" | grep '192\.168\.17')" ]
In close_stratumkey.sh line 9:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
In close_stratumkey.sh line 10:
$(dirname $0)/log.sh "zu ($NAME)"
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/log.sh "zu ($NAME)"
In close_stratumkey.sh line 11:
$(dirname $0)/close.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/close.sh
In genauth.sh line 7:
if ! /home/pi/stratumkey/genauth_keys.py > $tmpfile; then
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if ! /home/pi/stratumkey/genauth_keys.py > "$tmpfile"; then
In genauth.sh line 14:
FILES=/home/pi/stratumkey/keys/*.pub
^----------------------------^ SC2125 (warning): Brace expansions and globs are literal in assignments. Quote it or use an array.
In genauth.sh line 17:
sed 's/.pub//' <<< $(basename $file) > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf ${file} | awk '{ print $2 }')"
^-- SC2001 (style): See if you can use ${variable//search/replace} instead.
^---------------^ SC2046 (warning): Quote this to prevent 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:
sed 's/.pub//' <<< $(basename "$file") > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf "${file}" | awk '{ print $2 }')"
In genauth.sh line 20:
rm -- $tmpfile
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
rm -- "$tmpfile"
In init_stratumkey.sh line 1:
# the following gpios are used:
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
In open_stratumkey.sh line 2:
if [ -n "$(echo $SSH_CLIENT | grep '192\.168\.17')" ]
^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -n "$(echo "$SSH_CLIENT" | grep '192\.168\.17')" ]
In open_stratumkey.sh line 9:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
In open_stratumkey.sh line 10:
$(dirname $0)/log.sh "auf ($NAME)"
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/log.sh "auf ($NAME)"
In open_stratumkey.sh line 11:
$(dirname $0)/open.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/open.sh
In test_stratumkey.sh line 2:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
For more information:
https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
https://www.shellcheck.net/wiki/SC2125 -- Brace expansions and globs are li...
1 [nested] wucke13@zornpad> shellcheck *.sh ~/doc*/pr*/bas*/stratumkey
In bootstrap.sh line 9:
export NAME=$(cat "$NAME_FILE")
^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^-----------------^ SC2046 (warning): Quote this to prevent word splitting.
In bootstrap.sh line 11:
export NAME=$(who am i|awk '{ print $5}')
^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^---------------------------^ SC2046 (warning): Quote this to prevent word splitting.
In close_stratumkey.sh line 2:
if [ -n "$(echo $SSH_CLIENT | grep '192\.168\.17')" ]
^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -n "$(echo "$SSH_CLIENT" | grep '192\.168\.17')" ]
In close_stratumkey.sh line 9:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
In close_stratumkey.sh line 10:
$(dirname $0)/log.sh "zu ($NAME)"
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/log.sh "zu ($NAME)"
In close_stratumkey.sh line 11:
$(dirname $0)/close.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/close.sh
In genauth.sh line 7:
if ! /home/pi/stratumkey/genauth_keys.py > $tmpfile; then
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if ! /home/pi/stratumkey/genauth_keys.py > "$tmpfile"; then
In genauth.sh line 14:
FILES=/home/pi/stratumkey/keys/*.pub
^----------------------------^ SC2125 (warning): Brace expansions and globs are literal in assignments. Quote it or use an array.
In genauth.sh line 17:
sed 's/.pub//' <<< $(basename $file) > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf ${file} | awk '{ print $2 }')"
^-- SC2001 (style): See if you can use ${variable//search/replace} instead.
^---------------^ SC2046 (warning): Quote this to prevent 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:
sed 's/.pub//' <<< $(basename "$file") > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf "${file}" | awk '{ print $2 }')"
In genauth.sh line 20:
rm -- $tmpfile
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
rm -- "$tmpfile"
In init_stratumkey.sh line 1:
# the following gpios are used:
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
In open_stratumkey.sh line 2:
if [ -n "$(echo $SSH_CLIENT | grep '192\.168\.17')" ]
^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -n "$(echo "$SSH_CLIENT" | grep '192\.168\.17')" ]
In open_stratumkey.sh line 9:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
In open_stratumkey.sh line 10:
$(dirname $0)/log.sh "auf ($NAME)"
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/log.sh "auf ($NAME)"
[nested] wucke13@zornpad> shellcheck *.sh ~/doc*/pr*/bas*/stratumkey
In bootstrap.sh line 3:
MID=$(ps -p $PPID -o ppid=| sed s/[^0-9]*//g)
^----^ SC3026 (warning): In POSIX sh, ^ in place of ! in glob bracket expressions is undefined.
In bootstrap.sh line 7:
if [ -f $NAME_FILE ]
^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -f "$NAME_FILE" ]
In bootstrap.sh line 9:
export NAME=$(cat $NAME_FILE)
^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^---------------^ SC2046 (warning): Quote this to prevent word splitting.
^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
export NAME=$(cat "$NAME_FILE")
In bootstrap.sh line 11:
export NAME=$(who am i|awk '{ print $5}')
^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^---------------------------^ SC2046 (warning): Quote this to prevent word splitting.
In close_stratumkey.sh line 2:
if [ -n "$(echo $SSH_CLIENT | grep '192\.168\.17')" ]
^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -n "$(echo "$SSH_CLIENT" | grep '192\.168\.17')" ]
In close_stratumkey.sh line 9:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
In close_stratumkey.sh line 10:
$(dirname $0)/log.sh "zu ($NAME)"
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/log.sh "zu ($NAME)"
In close_stratumkey.sh line 11:
$(dirname $0)/close.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/close.sh
In genauth.sh line 7:
if ! /home/pi/stratumkey/genauth_keys.py > $tmpfile; then
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if ! /home/pi/stratumkey/genauth_keys.py > "$tmpfile"; then
In genauth.sh line 14:
FILES=/home/pi/stratumkey/keys/*.pub
^----------------------------^ SC2125 (warning): Brace expansions and globs are literal in assignments. Quote it or use an array.
In genauth.sh line 17:
sed 's/.pub//' <<< $(basename $file) > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf ${file} | awk '{ print $2 }')"
^-- SC2001 (style): See if you can use ${variable//search/replace} instead.
^---------------^ SC2046 (warning): Quote this to prevent 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:
sed 's/.pub//' <<< $(basename "$file") > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf "${file}" | awk '{ print $2 }')"
In genauth.sh line 20:
rm -- $tmpfile
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
rm -- "$tmpfile"
In init_stratumkey.sh line 1:
# the following gpios are used:
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
In open_stratumkey.sh line 2:
if [ -n "$(echo $SSH_CLIENT | grep '192\.168\.17')" ]
^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -n "$(echo "$SSH_CLIENT" | grep '192\.168\.17')" ]
In open_stratumkey.sh line 9:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
In open_stratumkey.sh line 10:
$(dirname $0)/log.sh "auf ($NAME)"
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/log.sh "auf ($NAME)"
In open_stratumkey.sh line 11:
$(dirname $0)/open.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/open.sh
In test_stratumkey.sh line 2:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
For more information:
https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
https://www.shellcheck.net/wiki/SC2125 -- Brace expansions and globs are li...
Shellchecker Lints Master
In bootstrap.sh line 3:
MID=$(ps -p $PPID -o ppid=| sed s/[^0-9]*//g)
^----^ SC3026 (warning): In POSIX sh, ^ in place of ! in glob bracket expressions is undefined.
In bootstrap.sh line 7:
if [ -f $NAME_FILE ]
^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -f "$NAME_FILE" ]
In bootstrap.sh line 9:
export NAME=$(cat $NAME_FILE)
^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^---------------^ SC2046 (warning): Quote this to prevent word splitting.
^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
export NAME=$(cat "$NAME_FILE")
In bootstrap.sh line 11:
export NAME=$(who am i|awk '{ print $5}')
^--^ SC2155 (warning): Declare and assign separately to avoid masking return values.
^---------------------------^ SC2046 (warning): Quote this to prevent word splitting.
In close_stratumkey.sh line 2:
if [ -n "$(echo $SSH_CLIENT | grep '192\.168\.17')" ]
^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -n "$(echo "$SSH_CLIENT" | grep '192\.168\.17')" ]
In close_stratumkey.sh line 9:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
In close_stratumkey.sh line 10:
$(dirname $0)/log.sh "zu ($NAME)"
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/log.sh "zu ($NAME)"
In close_stratumkey.sh line 11:
$(dirname $0)/close.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/close.sh
In genauth.sh line 7:
if ! /home/pi/stratumkey/genauth_keys.py > $tmpfile; then
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if ! /home/pi/stratumkey/genauth_keys.py > "$tmpfile"; then
In genauth.sh line 14:
FILES=/home/pi/stratumkey/keys/*.pub
^----------------------------^ SC2125 (warning): Brace expansions and globs are literal in assignments. Quote it or use an array.
In genauth.sh line 17:
sed 's/.pub//' <<< $(basename $file) > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf ${file} | awk '{ print $2 }')"
^-- SC2001 (style): See if you can use ${variable//search/replace} instead.
^---------------^ SC2046 (warning): Quote this to prevent 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:
sed 's/.pub//' <<< $(basename "$file") > "/home/pi/stratumkey/keys/names/$(ssh-keygen -lf "${file}" | awk '{ print $2 }')"
In genauth.sh line 20:
rm -- $tmpfile
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
rm -- "$tmpfile"
In init_stratumkey.sh line 1:
# the following gpios are used:
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
In open_stratumkey.sh line 2:
if [ -n "$(echo $SSH_CLIENT | grep '192\.168\.17')" ]
^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
if [ -n "$(echo "$SSH_CLIENT" | grep '192\.168\.17')" ]
In open_stratumkey.sh line 9:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
In open_stratumkey.sh line 10:
$(dirname $0)/log.sh "auf ($NAME)"
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/log.sh "auf ($NAME)"
In open_stratumkey.sh line 11:
$(dirname $0)/open.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
$(dirname "$0")/open.sh
In test_stratumkey.sh line 2:
source $(dirname $0)/bootstrap.sh
^-----------^ SC2046 (warning): Quote this to prevent word splitting.
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
source $(dirname "$0")/bootstrap.sh
For more information:
https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
https://www.shellcheck.net/wiki/SC2125 -- Brace expansions and globs are li...
Edited by wucke13 /