Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash scripting across linux and solaris



On Fri, Aug 28, 2009 at 4:11 PM, Theodore Ruegsegger<gruntly-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
>
> Well, yeah, the point is that if bash allows non-sh syntax then it's
> not "behaving as sh".

Right.  It would be nice if there were a strict sh compatibility mode in bash.

> 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.

> Obviously, if I can write flawless sh, then I don't need any warning,
> just as my flawless application code doesn't need any testing. Since I
> use bash all day as my interactive shell, it's hardly to be expected
> that I can write flawless sh without accidentally including some bash
> syntax.

I here you there, but to me this seems less like an sh vs. bash issue
and more like an issue with the shell programmers ability to recognize
and not use bash syntax in scripts intended to be portable to non-bash
systems.  Even if you're not an sh/bash expert, you can always catch
the non-portable stuff in testing.  Also, goes without saying that the
script is only truly portable if it's been tested on each target
platform.






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org