A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/koalaman/shellcheck/wiki/SC2148 below:

SC2148 · koalaman/shellcheck Wiki · GitHub

Tips depend on target shell and yours is unknown. Add a shebang.
echo "$RANDOM"   # Does this work?
#!/bin/sh
echo "$RANDOM"  # Unsupported in sh. Produces warning.

or

#!/bin/bash
echo "$RANDOM"  # Supported in bash. No warnings.

Different shells support different features. To give effective advice, ShellCheck needs to know which shell your script is going to run on. You will get a different numbers of warnings about different things depending on your target shell.

If you add a shebang (e.g. #!/bin/bash as the first line), the OS will use this interpreter when the script is executed, and ShellCheck will use this shell when offering advice.

If you for any reason can't or won't add a shebang, there are multiple other ways to let shellcheck know which shell you're coding for:

None. Please either add a shebang, directive, extension or use -s to maximize ShellCheck's usefulness.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4