Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Oct 2014 16:09:39 +0200
From:      Polytropon <>
To:        CyberLeo Kitsana <>
Cc:        "William A. Mahaffey III" <>, FreeBSD Questions <>
Subject:   Re: sh man page ....
Message-ID:  <>
In-Reply-To: <>
References:  <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
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... :-)

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

Want to link to this message? Use this URL: <>