Can someone explain what this shell script does? (docker entrypoint in node-14 dockerfile)

Solution 1:

[ "${1#-}" != "${1}" ] -- "first parameter starts with a dash"

[ -z "$(command -v "${1}")" ] -- "cannot find a binary with a name set in the first parameter ${1}"

set -- node "$@" -- "insert 'node' at the first place in the parameters list"

exec "$@" -- "take all the parameters as a string and execute it"

Looks like this has nothing to do with environment variables.

P.S. I think in the second block of code (with "command") the inner double quotes should be escaped.