[GONRG-4292] Fixed shellcheck warnings
Fixed warnings:
- [SC2046] Quote this to prevent word splitting. https://github.com/koalaman/shellcheck/wiki/SC2046
-
[SC2116] Useless echo? Instead of
cmd $(echo foo)
, just usecmd foo
. https://github.com/koalaman/shellcheck/wiki/SC2116 -
[SC2076] Don't quote rhs of
=~
, it'll match literally rather than as a regex. https://github.com/koalaman/shellcheck/wiki/SC2076 - [SC2155] Declare and assign separately to avoid masking return values. https://github.com/koalaman/shellcheck/wiki/SC2155
- [SC2013] To read lines rather than words, pipe/redirect to a while read loop. https://github.com/koalaman/shellcheck/wiki/SC2013
- [SC2162] read without -r will mangle backslashes. https://github.com/koalaman/shellcheck/wiki/SC2162
-
[SC1083] This
{/}
is literal. Check if;
is missing or quote the expression. https://github.com/koalaman/shellcheck/wiki/SC1083 -
[SC2048] Use
"$@"
(with quotes) to prevent whitespace problems. https://github.com/koalaman/shellcheck/wiki/SC2048 - [SC2062] Quote the grep pattern so the shell won't interpret it. https://github.com/koalaman/shellcheck/wiki/SC2062
- [SC2086] Double quote to prevent globbing and word splitting. https://github.com/koalaman/shellcheck/wiki/SC2086
- [SC2068] Double quote array expansions to avoid re-splitting elements. https://github.com/koalaman/shellcheck/wiki/SC2068
-
[SC2002] Useless
cat
. Considercmd < file | ..
orcmd file | ..
instead. https://github.com/koalaman/shellcheck/wiki/SC2002
Ignored warnings:
-
[SC2143] Use
grep -q
instead of comparing output with[ -n .. ]
. https://github.com/koalaman/shellcheck/wiki/SC2143 - [SC1091] Not following file https://github.com/koalaman/shellcheck/wiki/SC1091
Edited by Danylo Vanin (EPAM)