mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-03-12 12:35:25 -07:00
Updated SC2039 (markdown)
parent
c93fbcaaeb
commit
e5581ed182
@ -1,10 +1,9 @@
|
||||
## In POSIX sh, [[ ]] is undefined.
|
||||
|
||||
The shebang indicates that the script works with `/bin/sh`, but you are using non-standard features that may not be supported.
|
||||
## In POSIX sh, [\[ ]] is undefined.
|
||||
You have declared that your script works with `/bin/sh`, but you are using features that have undefined behavior according to the POSIX specification.
|
||||
|
||||
It may currently work for you, but it can or will fail on other OS, the same OS with different configurations, from different contexts (like initramfs/chroot), or in different versions of the same OS, including future updates to your current system.
|
||||
|
||||
Either declare a specific shell like `#!/bin/bash` or `#!/bin/dash` to make sure this shell is always used, or rewrite the script in a portable way.
|
||||
Either declare that your script requires a specific shell like `#!/bin/bash` or `#!/bin/dash`, or rewrite the script in a portable way.
|
||||
|
||||
For help with rewrites, the Ubuntu wiki has [a list of portability issues](https://wiki.ubuntu.com/DashAsBinSh) that broke people's `#!/bin/sh` scripts when Ubuntu switched from Bash to Dash. ShellCheck may not warn about all these issues.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user