Re: Non-POSIX shells
- From: Drazen Kacar <dave willfork com>
- To: Tom Tromey <tromey redhat com>
- Cc: Drazen Kacar <dave willfork com>, Sander Vesik <Sander Vesik Sun COM>, ERDI Gergo <cactus cactus rulez org>, GNOME hackers <gnome-hackers gnome org>
- Subject: Re: Non-POSIX shells
- Date: Wed, 6 Mar 2002 00:12:57 +0100
Tom Tromey wrote:
> >>>>> "Dave" == Drazen Kacar <dave willfork com> writes:
>
> Dave> The problem is that writing portable shell scripts is a black
> Dave> art. You can do it sucessfully if you test on a lot of systems.
>
> I think it has gotten less black in recent years. For instance the
> autoconf manual now includes a section on how to write a portable sh
> script. That's an important step forward.
I didn't know about that. It is a great thing, I agree.
> Dave> Figuring out if a script uses only POSIX constructs (and if
> Dave> all invoked utilities use POSIX constructs) involves testing on
> Dave> different systems. I don't know a way around that.
>
> If there was a free shell with a very strict portability mode, that
> would help. I don't know of one though :-(
Bash has --posix switch, although I don't know how well it works. But it's
not just the shell. The shell is more or less a glue for all other
utilities which would also have to have strict portability mode (triggered
by environment variable, I suppose). I think the other utilities present
bigger problems than the shell itself. "tr [a-z] [A-Z]" will do what the
author intended only in the C locale, although it might produce the intended
result in other locales on some systems.
Unportable shell constructs will usually produce errors. The above tr
example won't. It just won't work correctly and figuring out where the
problem was can take a lot of time and effort.
--
.-. .-. I don't think for my employer.
(_ \ / _)
| dave willfork com
|
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]