bug-autoconf
[Top][All Lists]
Advanced

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

ash and bash1 shell compatibility issues


From: Matthias Andree
Subject: ash and bash1 shell compatibility issues
Date: Sat, 7 Dec 2002 04:17:12 +0100
User-agent: Mutt/1.5.1i

Hi,

some more food for the autoconf 2.57 portable shell programming section,
edit and add. This information is public domain.

----------------
This won't work in ash 0.2:

set -e
[ -d directory ] && rm -f -r directory

The shell will exit if the directory does not exist. Normally, the "set
-e" exit is to be suppressed when the failing command is in a pipe
followed by || or &&.

Use 

if [ -d directory ] ; then rm -f -r directory ; else : ; fi

-----------------
It also seems that bash1 does not like

trap "if command1 ; then command2 ; else command3 ; fi" 0

It will barf with "syntax error: unexpected token then".

In my particular case, I was able to rewrite as

if command1 ; then trap "command2" 0 ; else command3 ; fi

But this is not generally possible.

-- 
Matthias Andree




reply via email to

[Prev in Thread] Current Thread [Next in Thread]