[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Another new 4.0 feature? functions can't return '1', (()) can't eval to
Another new 4.0 feature? functions can't return '1', (()) can't eval to 0?
Mon, 08 Aug 2011 20:43:36 -0700
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:22.214.171.124) Gecko/20100228 Thunderbird/126.96.36.199 Mnenhy/0.7.6.666
I have a function that returns true/false.
during development, (and sometimes thereafter depending on the script, I
run with -eu, to make sure the script stops as soon as there is a
problem (well, to 'try' to make sure, many are caught.
But there are two instances that cause an error exit that seem pretty
unuseful and I don't remember them breaking this way before.
((expr)), if expr evals to '0', it returns false=failure, the script
I regularly use ((expr) to do calculations -- now none of them appear
safe -- this never used to be a problem.
2) a function returning a false value -- Tried putting the ((expr)) in
if ((expr)); then return 0; else return 1;
As soon as it sees the return 1, it exits, -- as I returned 'false'
I know I used to be able to do calculations and turn expressions with -e
on, and not have to worry about the script existing just because I
return false to a bool function!
Are these more changes that went into recent versions or is there
something else going on or did something get seriously broken?
- Another new 4.0 feature? functions can't return '1', (()) can't eval to 0?,
Linda Walsh <=