From c93fbcaaebc40b1ae9b035e31a099055ba931e62 Mon Sep 17 00:00:00 2001 From: koalaman Date: Tue, 13 Oct 2015 10:34:46 -0700 Subject: [PATCH] Updated SC2039 (markdown) --- SC2039.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SC2039.md b/SC2039.md index ff12d92..59cbafc 100644 --- a/SC2039.md +++ b/SC2039.md @@ -1,10 +1,10 @@ -## `#!/bin/sh` was specified, but *something* is not standard. +## 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. -It may currently work for you, but it can or will fail on other OS, the same OS with different configurations or from different contexts (like initramfs/chroot), or different versions of the same OS, including future updates to your current system. +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 `#!/usr/bin/env bash` to make sure this shell is always used, or rewrite the script in a portable way. +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. 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.