3 ms·
Do not expand arguments with unquoted $* Use: "$@" You probably want local HASH=... and local DIRTY= in there. Also, why mix the old style
by kazinator 11y ago
Do not expand arguments with unquoted
$*
Use:
"$@"
You probably want
local HASH=...
and
local DIRTY=
in there.
Also, why mix the old style
`command ...`
and
$(command ...)
expansion.
- johnkeeping 11y ago`local` is a bash-ism so it's best avoided in this context, and the command is running in its own shell anyway so the variables can't pollute anything else. The other comments are 100% correct.
- kazinator 11y ago> so the variables can't pollute anything else The variables can already exist in the environment. One of them is tested by a statement that is reachable without that variable being initialized in that script. A fix that keeps the script POSIX would be to initialize the variable.