bash scripting across linux and solaris

Theodore Ruegsegger gruntly-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Fri Aug 28 17:10:36 EDT 2009


David wrote:
> On Fri, Aug 28, 2009 at 4:11 PM, Theodore Ruegsegger<gruntly-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
>> If I am writing a script in sh for portability,
>> I'd really like the shell to warn me when I stray from pure sh.
>
> In this case, you could test your scripts locally with dash prior to
> deployment on systems where sh isn't bash.

Which, as I said earlier, is what I'm doing since I develop on Ubuntu.
My point was that I hadn't realized I was doing it, since I assumed I
was using bash in, as you say "strict sh compatibility mode". It
wasn't until Matt's post prompted me to check it out that I realized
(a) I'd been mistaken and (b) I'd been lucky.

> ...Also, goes without saying that the
> script is only truly portable if it's been tested on each target
> platform.

Yes, especially since, as Eric's post reminded us, different versions
of the same shell can be incompatible. I'd expect this problem to
arise more with bash than with sh or dash, though.

Ted





More information about the Discuss mailing list