-1

In terminal if I run:

shellcheck -x my_script

I get no error, but if I run it without -x:

shellcheck my_script

I get this notification:

. ./functions/my_function

  ^-- SC1091: Not following: ... was not specified as input (see shellcheck -x).

SC1091 on GitHub link


ShellCheck location:

I'm working with self-compiled ShellCheck located in:

~/.cabal/bin/shellcheck

Goal:

I'm working with VS Code editor. Is there a way to force the -x switch in there somewhere?

3

Inside VS Code, the ShellCheck extension can be configured with optional arguments; from the settings:

ShellCheck Custom Args setting

open settings.json, and add something like

"shellcheck.customArgs": ["-x"],

(Thanks to muru for the hint.)

There are a couple of ways to use -x regardless of the tool invoking shellcheck:

  • you can set default options in SHELLCHECK_OPTS:

    export SHELLCHECK_OPTS='-x'
    
  • you could replace your binary:

    mv ~/.cabal/bin/shellcheck{,-real}
    printf '#!/bin/sh\nshellcheck-real -x "$@"\n' > ~/.cabal/bin/shellcheck
    chmod 755 ~/.cabal/bin/shellcheck
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.