== Bashisms in _#!/bin/sh_ scripts are not necessarily bugs In the wake of [[Shellshock http://en.wikipedia.org/wiki/Shellshock_%28software_bug%29]], any number of people have cropped up in any number of places to say that you should always be able to change a system's _/bin/sh_ to something other than Bash because Bashisms in scripts that are specified to use _#!/bin/sh_ are a bug. It is my heretical view that these people are wrong in general (although potentially right in specific situations). First, let us get a trivial root out of the way: a Unix distribution is fully entitled to assume that you have not changed non-adjustable things. If a distribution ships with _/bin/sh_ as Bash and does not have a supported way to change it to some other shell, then the distribution is fully entitled to write its own _#!/bin/sh_ shell scripts so that they use Bashisms. This may be an unwise choice on the distribution's part, but it's not a bug unless they have an official policy that all of their shell scripts should be POSIX-only. (Of course the distribution may act on {{AB:RFE:Request For Enhancement}}s that their _#!/bin/sh_ scripts not use Bashisms. But that's different from it being a *bug*.) Next, let's talk about user scripts. On a system where _/bin/sh_ is always officially Bash, ordinary people are equally entitled to assume that your systems have not been manually mangled into unofficial states. As a result they are also entitled to write their _#!/bin/sh_ scripts with Bashisms in them, because these scripts work properly on all officially supported system configurations. As with distributions, this may not be a wise choice (since it may cause pain if and when they ever move those scripts to another Unix system) but it is not a *bug*. The only case when it even approaches being a bug is when the distribution has officially included large warnings saying '_/bin/sh_ is currently Bash but it may be something else someday, you should write all _/bin/sh_ shell scripts to POSIX only, and here is a tool to help with that'. There are some systems where this is the case and has historically been the case, and on those systems you can say that people using Bashisms in _#!/bin/sh_ scripts clearly have a bug by the system's official policy. There are also quite a number of systems where this is or has not been the case, where the official _/bin/sh_ is Bash and always has been. On those systems, Bashisms in _#!/bin/sh_ scripts are not a bug. (By the way, only relatively recently have you been able to count on _/bin/sh_ being POSIX compatible; see [[here ../unix/PortableShThreeUnixes]]. Often it's had very few guarantees.) By the way, as a [[pragmatic matter ../unix/PortableShThreeUnixes]] a system with only Bash as _/bin/sh_ is likely to have plenty of _/bin/sh_ shell scripts with Bashisms in them even if the official policy is that you should only use POSIX features in such scripts. This is a straightforward application of [[one of my aphorisms of system administration SysadminAphorismII]] (and perhaps also [[this one SysadminAphorismIII]]). These scripts have a nominal bug, but of course people are not going to be happy if you break them.