Mailinglist Archive: opensuse-factory (602 mails)

< Previous Next >
Re: [opensuse-factory] Can we assume that /bin/sh is bash?
On Tue, Feb 19, 2019 at 12:28:02PM +0100, Joerg Schilling wrote:

So I recommend to try out other shells and to check the current scripts for
kshisms and bashisms. It may of course help to firsh use something like
"checkbashisms" on scripts that have #!/bin/sh inside or that do not have #!
at all.

This has been done with Gentoo Linux 2 years ago with pbosh and this helped
to
identify and fix things that have been related to non-POSIX behavior in pbosh
as a result that this shell is a descendent from the original Bourne Shell
and
the fact that not all differences between Bourne Shell and POSIX shell had
been
documented before. So my advise is: do it and check whether you have system
scripts that depend on non standard behavior. You may have luck and there is
few to change.

BTW: In 2008, OpenSolaris has been converted to have ksh93 as /bin/sh and
several scripts have been changed. I needed to introduce minor changes (mainly
to avoid [[ ]]) into three system scripts in order to be able to install
pbosh
as /bin/sh.

Ouch ... IMHO [[...]] is a major win for a bourne shell. If you're
teaching shell syntax there is no nead to mention [...] but only [[...]]
with ksh93 and bash. I do not see any advantage to use a minimal set
of POSIX bourne shell. Here we have the fully control which bourne shell
should be used for /bin/sh. If systems will be ported from an old UNIX
system (and IMHO OpenSolaris is old ;) most most scripts will run even if
written for minimal POSIX bourne shell. There is no need to use a
castrated bourne shell aka minimal POSIX bourne shell on Linux.

--
"Having a smoking section in a restaurant is like having
a peeing section in a swimming pool." -- Edward Burr
< Previous Next >
Follow Ups