From owner-freebsd-questions@FreeBSD.ORG Sun Oct 12 14:09:49 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 D2437126 for ; Sun, 12 Oct 2014 14:09:49 +0000 (UTC) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.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 95861BEE for ; Sun, 12 Oct 2014 14:09:49 +0000 (UTC) Received: from r56.edvax.de (port-92-195-30-92.dynamic.qsc.de [92.195.30.92]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id BA35B276A5; Sun, 12 Oct 2014 16:09:40 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id s9CE9dRJ002406; Sun, 12 Oct 2014 16:09:39 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sun, 12 Oct 2014 16:09:39 +0200 From: Polytropon To: CyberLeo Kitsana Subject: Re: sh man page .... Message-Id: <20141012160939.f131b6b9.freebsd@edvax.de> In-Reply-To: <5439C1D0.6030902@cyberleo.net> References: <5437FB8B.9080008@hiwaay.net> <5439C1D0.6030902@cyberleo.net> 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: "William A. Mahaffey III" , FreeBSD Questions 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: Sun, 12 Oct 2014 14:09:49 -0000 On Sat, 11 Oct 2014 18:48:32 -0500, CyberLeo Kitsana wrote: > Try running devel/checkbashisms against the scripts. It's something > Debian uses to ease migration from Bash to Dash in their base system, > and I've found it rather useful to ensure no bashisms sneak into my own > portable scripts. This is a very good advice, because "portable scripts" isn't entirely obvious and normal in Linux anymore. And as soon as you leave the Linux world and need to have the same script run on other UNIX systems (BSD, Solaris, maybe even HP-UX or AIX, maybe even on Mac OS X, or if you're totally insane, on IRIX), having the scripts rely on things you take for granted ("because it works in bash, and that's the same thing across all platforms, right?") is a bad idea. For example, you can easily spot Linux scripts if their first line is "#!/bin/bash". This isn't even "standard" anymore on Linux, as some distributions have moved to the dash shell as their default scripting shell. But just writing "#!/bin/sh" doesn't make bashisms magically work on non-bash shells. Having a tool to test for those cases is a good help, so you don't run into "unexpected behaviour" in combination with the "works on _my_ machine" mentality. Oh, and don't get me started on the rare fact that you think you have a POSIX shell, and your script only uses what POSIX specifies, and then you suddenly find out that the shell isn't 100% POSIX... :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...