Dash, Bash, and other musings

Archaic archaic at linuxfromscratch.org
Mon Mar 23 16:45:17 PDT 2009


On Mon, Mar 23, 2009 at 10:02:07PM +0200, Agathoklis D. Hatzimanikas wrote:
> 
> Yes, this came up a few times and there is no reason to repeat
> ourselves. I think the consensus was that following established standards
> is the way to go, so there isn't any real argument left for using Bash
> for login scripts.
> 
> However if this is not going to happen, which is quite possible, I would
> prefer to use #!/bin/bash rather than #!/bin/sh in our scripts.
> Keep /bin/sh for only POSIX compliant scripts.

The boot scripts are (as of the last time I looked) POSIX compliant. So
there is no reason to change the shebang. It was intentional that
/bin/sh was used so they would work for more than just bash. There's no
sense in using /bin/bash if there are no bash extensions in the script.
This *may* allow a person to remove bash from LFS, but not likely as
some packages require it at build time or run time or both.

There is a similar argument with mawk vs. gawk. The main difference is
that Linux is not defined by which awk you have. GNU tools may be,
though. Linux, regardless of distro, is historically defined as
providing bash (regardless if it is used as a person's shell) and
assumptions are made because of that, right or wrong. Solaris, HP-UX,
AIX, *BSD each have a shell that is expected to be available and
assumptions are made because of that, too. Sometimes this is a POSIX
compatible shell, sometimes not.

The interaction between closed UNIXs and open ones is still a fairly new
thing (relatively speaking) and a lot of *workarounds* for system shells
is still very much in use in portable scripts. It is the portability
that drives progress, though. As an aside, Bash is making its way
everywhere because, frankly, Linux has captured the attention of
powerful people making it the "cool" flavor of UNIX. It is not outside
the scope of reality that the next POSIX spec could include many of
bash's extensions (and of those, many came from other shells), if bash
gains a very high level of widespread use among the existing flavors of
UNIX, but this is also politically motivated.

As I understand it, dash is not a bash replacement, but rather an sh
replacement. For those of you who have a distro that attempts (either by
asking or not) to install dash as sh, what is the default interactive
shell? *If* dash is not meant to be used as the default interactive
shell, what would LFS gain towards its goal of being a small, but not
bare-bones, development platform on which to extend as you see fit? Dash
would not be anything close to necessary, but I'm betting bash would.
That is, I'm betting a bash-less LFS would require more patches/seds.
Bash is as much expected to be on a Linux system as glibc. This doesn't
mean it can't be removed, just that a lot more effort is required than
simply installing a replacement. But or those who do want dash, the
POSIXization of the bootscripts allows dash to be added hopefully
without any pain.

> Oh well, almost all. I'd rather get rid of Bash (thank god I am not a religious).

But yet you say something that could start a religious war? :D

Perl is nice, and by now is probably more portable than bash or sh. If
it could be sh, I'd go for it (but I'd still have bash available).
However, too many language choices isn't necessarily a good thing.

-- 
Archaic




More information about the lfs-dev mailing list