Portable Shell Programming – Resources and References

portabilityreferenceshellstandard

What resources exist for portable shell programming? The ultimate answer is to test on all targeted platforms, but that's rarely practical.

The POSIX / Single UNIX specification is a start, but it tells neither you what the level of support of each implementation is, nor what common extensions exist. You can read the documentation of each implementation, but that's very time consuming and not completely accurate.

I seems to me that an ideal format would be some kind of community-annotated version of the POSIX spec, where each feature is annotated by its support level amongst the different implementations. Is there such a thing? Or are there other useful resources?


For example, there is Sven Mascheck's shell portability pages, but it's only about syntactic elements and a few built-ins, and only covers old shells. I'm looking for a more comprehensive resource.

Best Answer

The autoconf manual has a section on portable shell programming.

Although that's not specifically targeting POSIX, it's probably the most complete collection of what to do and not to do when attempting to write portable shell code.

Related Question