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

SC2016 false positive with OpenShift client #3033

Closed dereckson closed 3 months ago

dereckson commented 3 months ago

This issue is very similar to #1161, but when the container is run with oc rsh instead of docker.

oc is the OpenShift client, and oc rsh allows to get a remote shell in a pod container.

For bugs

Here's a snippet or screenshot that shows the problem:

#!/bin/sh
oc rsh "$pod" sh -c 'mysql -uroot -p$MARIADB_ROOT_PASSWORD -e "SELECT 1+1;"'

Here's what shellcheck currently says:

In test-SC2016-oc.sh line 476:
oc rsh "$pod" sh -c 'mysql -uroot -p$MARIADB_ROOT_PASSWORD -e "SELECT 1+1;"'
                    ^-- SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.

Here's what I wanted or expected to see:

It passes, like for sudo and docker commands.