Most of the configuration and scripting in wigwam-base
is done in sh-script; this would work
out well if sh were standard, but they differ.
Meticulous sh-scripters should always make sure that their
scripts run correctly in ash, a minimal,
posix 1003.2a-compliant shell. Below we will describe common
problems with conforming to this shell, and other really obnoxious sh
idiosyncrasies.
Here we collect a bunch of common idioms in sh-scripting,
and introduce you to some macros in ext/bin/sh-macros.
- Checking if an environment variable is empty
if test "x$ENV_VARIABLE" = "x" ; then ... |
- Checking if a file, directory exists
Use
to see if you can read a file or
to see if you have write permission, and
to see whether a directory exists. isn't available on Solaris 7.
- Checking if a file is executable
- isn't on BSD 4.2,
However, the sh-macros file defines test_x which
you can use to test a file's executability (it falls back to test -r though).
- Setting an environment variable only if it isn't set
... copy from autoconf docs ...