[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting invocation as /bin/sh ?

From: Alexandre Ferrieux
Subject: Re: Detecting invocation as /bin/sh ?
Date: Fri, 26 Sep 2014 13:48:35 -0700 (PDT)
User-agent: G2/1.0

On Friday, September 26, 2014 2:14:46 PM UTC+2, Greg Wooledge wrote:
> On Thu, Sep 25, 2014 at 11:53:18PM -0700, Alexandre Ferrieux wrote:
> > Of course, their intention is precisely expressed by the '#!/bin/sh' header
> Unfortunately, most people don't actually express an intent when they
> use #!/bin/sh.  They just copy some code from a random script they found
> somewhere, without understanding what it means.

That song reminds me of PHP. I was under the optimistic assumption that bash, 
given its noble ancestry, was not exactly targeting the same audience. 

> The number of scripts that use #!/bin/sh but then go on to use Bash
> syntax is higher than you might believe. 

OK. Sh*t happens. Bozos write scripts. So what ?
A more interesting question IMO is:

 How many packaged init scripts / mission-critical daemons are written by 
people that cannot be bothered to write #! /bin/bash when they require bash ? 

> It's not a stretch of the imagination to suppose that someone has used
> exported functions in a #!/bin/sh script on a Linux box where /bin/sh
> is a symlink to bash.

Except that script would instantly break if *dash* was installed, instead of 
bash, as target of the sh symlink. So that beast would already be extremely 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]