koalaman / shellcheck

ShellCheck, a static analysis tool for shell scripts
https://www.shellcheck.net
GNU General Public License v3.0
36.45k stars 1.78k forks source link

/bin/dash detect error #3040

Open Mon-ius opened 3 months ago

Mon-ius commented 3 months ago

try to consider, and compare,

curl -fsSL -o /dev/null -X PUT "$REG_URL/$id/account" \
    -H "Authorization: Bearer $token" \
    -H "Content-Type: application/json" \
    -d '{
        "license":'"${ROOT_LICENSE}"'
    }'

curl -fsSL -o /dev/null -X PUT "$REG_URL/$id/account" \
    -H "Authorization: Bearer $token" \
    -H "Content-Type: application/json" \
    -d '{
        "license":'"${license}"'
    }'

And,

curl -fsSL -o /dev/null -X PUT "$REG_URL/$id/account" \
    -H "Authorization: Bearer $token" \
    -H "Content-Type: application/json" \
    -d '{
        "license":"'${ROOT_LICENSE}'"
    }'

curl -fsSL -o /dev/null -X PUT "$REG_URL/$id/account" \
    -H "Authorization: Bearer $token" \
    -H "Content-Type: application/json" \
    -d '{
        "license":"'${license}'"
    }'

The detection approach is obvious wrong, which detection the right one as issued one, and the error one as correct, caused fundamental error.