:: Re: [DNG] Danger: Debian POSIX host…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Steve Litt
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] Danger: Debian POSIX hostility
On Tue, 22 Sep 2020 10:53:15 +0100
Peter Duffy <peter@???> wrote:

> On Mon, 2020-09-21 at 18:07 -0700, Rick Moen wrote:
> > Quoting marc (marcxdv@???):
> >
> > > Hmm - that might require some background: I'd venture that most of
> > > these scripts were written when sh was just a symlink to bash, and
> > > dash didn't exist, nevermind as a debian package.
> >
> > But that was always a blunder. The shebang should have been set to
> > bash explicitly, if bash-specific features are used: In the cases
> > of which you spoke, the coder made a lazy and unsupportable
> > assumption.
>
> With respect, I'd tend to disagree with that to some extent. The
> /bin/sh symlink is built in, and is there from the point that the
> system is installed. So it's a feature made available to users, and
> it's arguably not a blunder to use it. Whether it's a good feature or
> not is definitely a moot point. The convention in linux (think since
> it originated) was that /bin/sh pointed to bash - until Debian
> decided to do it differently.


I would never use Bash in a shellscript. Therefore, do you think my
shebang should just go straight to #!/bin/dash instead of #!/bin/sh ?
That would certainly take the ambiguity out of it.

Or maybe I should shebang all my shellscripts #!/bin/littshell . That
way, if I ever found a better alternative than dash, or if I operated
on a system without dash, I could just change a symlink. The downside
would be that none of my shellscripts could work on computers without
the /bin/littshell symlink.

Or should I just make sure /bin/sh always points to dash?

Thanks,

SteveT

Steve Litt
Autumn 2020 featured book: Thriving in Tough Times
http://www.troubleshooters.com/thrive