From owner-freebsd-questions@FreeBSD.ORG Fri Dec 12 06:13:59 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7BB4438 for ; Fri, 12 Dec 2014 06:13:59 +0000 (UTC) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 762343EB for ; Fri, 12 Dec 2014 06:13:59 +0000 (UTC) Received: from r56.edvax.de (port-92-195-5-37.dynamic.qsc.de [92.195.5.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 94E863CD71; Fri, 12 Dec 2014 07:13:57 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id sBC6DvKJ002329; Fri, 12 Dec 2014 07:13:57 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Fri, 12 Dec 2014 07:13:57 +0100 From: Polytropon To: Alex Stangl 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> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2014 06:13:59 -0000 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, ...