On Fri, Aug 13, 2021 at 10:10:42AM -0400, Chet Ramey wrote: > As long as you stick to things POSIX standardizes. Relevant here, the > standard even includes a list of variables you should avoid using because > various shells and applications use them.
Just out of curiosity, where is that? It's not under section 2.5.3 Shell Variables, which is where I looked first. The closest thing I could find is a section in the Rationale that describes some variables that are no longer covered by the standard, but either used to be, or are commonly used as extensions: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_05_03 Is there another section that I've missed? > Obviously not, since they never tested it on bash. It's more likely they > expected it to run on Debian's /bin/sh -- hence the hashbang -- which is > dash. For the record, Debian uses dash as /bin/sh by default in modern versions, but historically, it used bash. And it still offers the user a supported means of switching "back" to bash as /bin/sh, for systems that require it. A Debian shell script which uses #!/bin/sh should be written to work under bash *or* dash (at the very minimum). If it fails under either of those shells, it's a bug.