[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
From: |
Linda Walsh |
Subject: |
Another new 4.0 feature? functions can't return '1', (()) can't eval to 0? |
Date: |
Mon, 08 Aug 2011 20:43:36 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 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.
1)
((expr)), if expr evals to '0', it returns false=failure, the script
stops.
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
an if:
if ((expr)); then return 0; else return 1;
As soon as it sees the return 1, it exits, -- as I returned 'false'
(error).
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 <=