Maybe somebody knows a good Bourne Shell book or tutorial?

Polytropon freebsd at edvax.de
Fri Dec 12 06:13:59 UTC 2014


On Thu, 11 Dec 2014 23:58:02 -0600, Alex Stangl wrote:
> On Fri, Dec 12, 2014 at 06:26:31AM +0100, Polytropon wrote:
> > Additionally, it's worth knowing the _difference_ between
> > the Bourne Shell and the BASH extensions, because those
> > two shells aren't the same, even though there are people
> > who seem to think this. When the "dash" shell enters the
> > stage, the fun is about to start. ;-)
> 
> Many of us prefer to just target the POSIX standard.
> This way our scripts should just work on any POSIX-compliant
> shell.

In this context, always make sure that things you
assume to be POSIX _actually are_ POSIX. Many years
ago, I had to deal with a problem on... I think it
was Solaris (or even SunOS?) with a shell that the
"person of wisdom" told me was a POSIX shell. In
fact, it wasn't _fully_ POSIX-compliant, and the
very exceptional worst case bit. ;-)



> Oftentimes it seems like people use BASH-isms not
> because there is any requirement to do so, or any performance
> reason, but simply because they always use BASH and it just
> seems natural to them to use all of its scripting language.

Depends. If your learning environment is Linux (or at
least a distribution defaulting to bash), you'll probably
don't get aware of the differences between shells "of the
same production line". And as long as you stick to that
environment, you will be safe from surprises.



> For those of us sticking with POSIX, I'm not sure what the
> value of looking at BASH extensions is, except possibly
> if needing to translate a script littered with BASH-isms.

That's the situation I was thinking of: Porting bash scripts
to regular sh. It's often not as easy as replacing "#!/bin/bash"
by "#!/bin/sh".



> If dash helps people see the value of sticking to standards,
> that seems like a good thing.

In my opinion, the _knowledge_ that there are standards
like POSIX which help with portability is important, and
it helps to fight the statement that "there is only one
shell, and that shell is bash, and it's the same shell
everywhere and for everyone". :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list