bug-bash
[Top][All Lists]
Advanced

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

feature request: more complete set -e


From: Marc Weber
Subject: feature request: more complete set -e
Date: Tue, 23 Jun 2009 03:13:18 +0200
User-agent: Mutt/1.5.16 (2007-06-09)

Hi,

I stumbled about another bash problem today:

for item in $(false);
  echo $item
done || { echo for failed; }

doesn't fail. I think it's bad that there is no
  set -e 

like switch which really catches all failures of this kind.

If you want to ignore non zero exit status you can always use || true.

Of course the workaround is obvious: use

  dummy_var=$(false)
  for item in $dummy_var;
    echo $item
  done || { echo for failed; }

However you have to remeber this pitfall.

I know that some scripts may depend on the current behaviour.
So what about adding a new switch beeing more strict?

Sincerly
Marc Weber




reply via email to

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