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
fragile.
-Alex