Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Dec 2014 07:13:57 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Alex Stangl <alex@stangl.us>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Maybe somebody knows a good Bourne Shell book or tutorial?
Message-ID:  <20141212071357.c0676fa9.freebsd@edvax.de>
In-Reply-To: <20141212055802.GB45115@scout.stangl.us>
References:  <54892F4C.1030906@rawbw.com> <20141211200241.GA43214@scout.stangl.us> <548A1095.6010301@radel.com> <20141212062631.a3d891fe.freebsd@edvax.de> <20141212055802.GB45115@scout.stangl.us>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141212071357.c0676fa9.freebsd>