Re: Non-POSIX shells



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
     |
_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers



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