tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: set -e again
> I discovered the following today.
> [...sh set -e oddity...]
> Furthermore, all the shells I have in easy reach agree on it.
So do 5.2's and even 1.4T's sh.
I also tried changing
echo foo
to
echo "foo $-"
to see if perhaps -e was getting turned off inside the function.
Apparently not; I get "foo e" regardless of whether f's return is
checked or not.
Also, interestingly, adding the three lines "local -", "set +e", and
"set -e" to the beginning of f() does not change this.
> This seems wrong
I concur, especially since I too have been unable to find any way to
get the effect of set -e within f when f is the LHS of ||. { }
doesn't help. Neither does ( ). Neither does setting -e after
defining f. Neither does setting e only within f, not in the main
script (!!). (These tests done with 5.2's sh.)
> But also, the fact that everybody agrees makes me think it's probably
> the agreed result of the last round of POSIX wrangling over the -e
> definition some years back.
If so, *quite* some years back, in that 1.4T's sh agrees. Unless
Bourne's own work did this and everyone else felt it necessary to
ensure compatibility.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index