[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
functions and set -e
From: |
Greg Schafer |
Subject: |
functions and set -e |
Date: |
Wed, 30 Aug 2006 13:28:44 +1000 |
User-agent: |
Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) |
Hi
Here's a test case which demonstrates the problem:
#!/bin/sh
set -e
func () {
false && echo false
true && echo true
false && echo false
}
func
echo done
It never echoes "done" because func() returns 1. This seems to go against
what the bash manual says about "set -e"
"Exit immediately if a simple command (*note Simple Commands::) exits with a
non-zero status, unless the command that fails is part of the command list
immediately following a `while' or `until' keyword, part of the test in an `if'
statement, part of a `&&' or `||' list,...."
The problem appears to be specific to functions. Is this a bug?
Thanks
Greg
- functions and set -e,
Greg Schafer <=