SpaceCadet,
@SpaceCadet@feddit.nl avatar

Oh I wanted to say, “Do not use #!/bin/sh if you’re not writing bash-only scripts”

Hah, I was wondering if that was wat you actually meant. The double negation made my head spin a bit.

I have run into scripts that don’t work on Debian, because the author used bashisms but still specified /bin/sh as the interpreter.

The weird thing is that man bash still says:


<span style="color:#323232;">When invoked as sh, bash enters posix mode after the startup files are read.
</span><span style="color:#323232;">...
</span><span style="color:#323232;">--posix
</span><span style="color:#323232;">    Change  the  behavior  of bash where the default operation differs from the POSIX standard to 
</span><span style="color:#323232;">    match the standard (posix mode). See SEE ALSO below for a reference to a document that details 
</span><span style="color:#323232;">    how posix mode affects bash's behavior.
</span>

But if you create a file with a few well known bashisms, and a #!/bin/sh shebang, it runs the bashisms just fine.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • fightinggames
  • All magazines