From: Pavel Roskin Date: Thu, 19 Oct 2000 21:30:29 +0000 (+0000) Subject: * doc/autoconf.texi (Shellology): Documented quirks in ash-0.2. X-Git-Tag: autoconf-2.50~549 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=247e1d11ad9ca006b8f105e706e937410fa9fab0;p=thirdparty%2Fautoconf.git * doc/autoconf.texi (Shellology): Documented quirks in ash-0.2. --- diff --git a/ChangeLog b/ChangeLog index 451a45c58..7187c0c5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2000-10-19 Pavel Roskin + + * doc/autoconf.texi (Shellology): Documented quirks in ash-0.2. + 2000-10-18 Pavel Roskin * mdate-sh: Removed, its copy remains in the doc/ directory. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index df106c3a3..b25ab60fe 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -4971,6 +4971,55 @@ To detect whether you are running @command{zsh}, test if compatible with the Bourne shell: you have to run @samp{emulate sh} and set @code{NULLCMD} to @samp{:}. @xref{Compatibility,, Compatibility, zsh, The Z Shell Manual}, for details. + +@item @command{ash} +@cindex @command{ash} +@command{ash} is often used on @sc{gnu}/Linux and @sc{bsd} systems as a +light-weight Bourne-compatible shell. @command{ash} version 0.2 has +some bugs that are fixed in the 0.3.x series, but portable shell scripts +should workaround them, since version 0.2 is still shipped with many +@sc{gnu}/Linux distributions. + +To be compatible with @command{ash} 0.2 + +@itemize @bullet +@item +don't rely on variable assignment setting @samp{$?} unless the +assignment involves command substitution: + +@example +false || foo=bar && echo "Not portable" +false || foo=`bar` && echo "Portable" +@end example + +@item +don't use @samp{$?} after expanding empty or unset variables: + +@example +foo= +false +$foo +echo "Don't use it: $?" +@end example + +@item +don't use command substitution within variable expansion: + +@example +echo $@{FOO=`bar`@} +@end example + +@item +beware that @command{exit} inside command substitution causes the +current shell exit as well. Use parentheses to prevent @command{ash} +from exiting: + +@example +(`exit 1`) || echo "All right" +`exit 1` || echo "ash won't print it" +@end example + +@end itemize @end table