From: bcrocker on
gitlab.com
Fix syntax flagged by shellcheck in all scripts in the redhat/ subtree.
A complete 'git log -p' of all commits on this branch can be found at:
http://pastebin.test.redhat.com/917268
SC2001: See if you can use ${variable//search/replace} instead.\
SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..'
instead.\
SC2006: Use $(...) notation instead of legacy backticked `...`.\
SC2007: Use $((..)) instead of deprecated $[..]\
SC2013: To read lines rather than words, pipe/redirect to a 'while read'
loop. ???\
SC2034: <variable> appears unused. Verify use (or export if used
externally).\
SC2035: Use ./*glob* or -- *glob* so names with dashes won't become
options.\
SC2038: Use -print0/-0 or find -exec + to allow for non-alphanumeric
filenames.\
SC2045: Iterating over ls output is fragile. Use globs.\
SC2046: Quote this (command) to prevent word splitting.\
SC2068: Double quote array expansions to avoid re-splitting elements.\
SC2086: Double quote to prevent globbing and word splitting.\
SC2144: -f doesn't work with globs. Use a for loop.\
SC2145: Argument mixes string and array. Use * or separate argument.\
SC2155: Declare and assign separately to avoid masking return values. \
SC2162: read without -r will mangle backslashes.\
SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.\
SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly
with $?.\
SC2196: egrep is non-standard and deprecated. Use grep -E instead.\
SC2231: Quote expansions in this for-loop glob to prevent
wordsplitting.\
SC2236: Use -z instead of ! -n.\
Change to #!/bin/bash explicitly to allow\
SC2039: bash-isms
Disable:\
SC2164: Use 'pushd ... || exit' or 'pushd ... || return' in case pushd
fails.\
SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
Disable checking for one instance of:
SC2059: Don't use variables in the printf format string. Use printf
"..%s.." "$foo".
The pattern in question is a multi-line string; the shellcheck wiki,\
https://github.com/koalaman/shellcheck/wiki/SC2059, acknowledges that\
there is no good rewrite for this construct and recommends disabling\
the warning.