DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(autoconf.info.gz) Portable Shell

Info Catalog (autoconf.info.gz) Writing Autoconf Macros (autoconf.info.gz) Top (autoconf.info.gz) Manual Configuration
 
 Portable Shell Programming
 **************************
 
    When writing your own checks, there are some shell-script programming
 techniques you should avoid in order to make your code portable.  The
 Bourne shell and upward-compatible shells like the Korn shell and Bash
 have evolved over the years, but to prevent trouble, do not take
 advantage of features that were added after UNIX version 7, circa 1977
 ( Systemology).
 
    You should not use shell functions, aliases, negated character
 classes, or other features that are not found in all Bourne-compatible
 shells; restrict yourself to the lowest common denominator.  Even
 `unset' is not supported by all shells!  Also, include a space after
 the exclamation point in interpreter specifications, like this:
 
      #! /usr/bin/perl
 
 If you omit the space before the path, then 4.2BSD based systems (such
 as DYNIX) will ignore the line, because they interpret `#! /' as a
 4-byte magic number.  Some old systems have quite small limits on the
 length of the `#!' line too, for instance 32 bytes (not including the
 newline) on SunOS 4.
 
    The set of external programs you should run in a `configure' script
 is fairly small.   Utilities in Makefiles (standards)Utilities in
 Makefiles, for the list.  This restriction allows users to start out
 with a fairly small set of programs and build the rest, avoiding too
 many interdependencies between packages.
 
    Some of these external utilities have a portable subset of features;
 see  Limitations of Usual Tools.
 
    There are other sources of documentation about shells.  See for
 instance the Shell FAQs(1).
 

Menu

 
* Shellology                  A zoology of shells
* Here-Documents              Quirks and tricks
* File Descriptors            FDs and redirections
* File System Conventions     File- and pathnames
* Shell Substitutions         Variable and command expansions
* Assignments                 Varying side effects of assignments
* Special Shell Variables     Variables you should not change
* Limitations of Builtins     Portable use of not so portable /bin/sh
* Limitations of Usual Tools  Portable use of portable tools
* Limitations of Make         Portable Makefiles
 
    ---------- Footnotes ----------
 
    (1) the Shell FAQs, <http://www.faqs.org/faqs/unix-faq/shell/>.
 
Info Catalog (autoconf.info.gz) Writing Autoconf Macros (autoconf.info.gz) Top (autoconf.info.gz) Manual Configuration
automatically generated byinfo2html