The only way you would get that error is if you were using the shellcheck checker, in order to remove these warnings you need to customize the command flycheck is using for shellcheck, there is no built in way to customize the existing shellcheck checker, but you can create a new checker with that feature.
You'll need to create a new flycheck checker that is just like the existing shellcheck checker but makes use of the "-e" option that allows you to exclude errors types.
(defvar shellcheck-exclude-types '("SC2029")
"Shellcheck error types to exclude from flycheck")
(flycheck-define-checker sh-my-shellcheck
"Custom shellcheck checker"
:command ("shellcheck" "-f" "checkstyle"
;; here we join all the exclude types in the -e option
;; like: -e=SC2029,sc20xxx,...
;; this is the only NEW line to the existing shellcheck checker
(eval (concat "-e=" (string-join shellcheck-exclude-types ",")))
"-s" (eval (symbol-name sh-shell))
source)
:modes sh-mode
:error-parser flycheck-parse-checkstyle
:predicate (lambda () (memq sh-shell flycheck-shellcheck-supported-shells)))
I found that SC2029 is the code for that kind of error by running shellcheck from the command line on the file, I have no idea where all the codes are documented.
Once you have your checker defined, you'll need to activate it.
One way to do it is:
(add-hook 'sh-mode-hook (lambda () (flycheck-select-checker 'sh-my-shellcheck)))