On 09/11/2012 09:24 AM, Марк Коренберг wrote:
>> This behavior conforms to POSIX.
>>
>>>
>>> Is any way to force "set -e" to work even in such cases?
>>
>> No, it is already working as specified (just not the way you want).
>>
> 1. Can you give me link (or name of) posix standard where I can read
On Tue, Sep 11, 2012 at 09:24:39PM +0600, ?? wrote:
> 1. Can you give me link (or name of) posix standard where I can read about
> this?
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25
"When this option is on, if a simple command fails
2012/9/11 Eric Blake
> On 09/11/2012 05:51 AM, Марк Коренберг wrote:
> > fun()
> > {
> > echo 'Execute really bad command:'
> > /bin/false
> > echo 'should not print this'
> > return 0
> > }
> >
> > if ! fun; then
> > echo 'should catch fault here'
>
> Wrong. '! fun' is execu
On 09/11/2012 05:51 AM, Марк Коренберг wrote:
> fun()
> {
> echo 'Execute really bad command:'
> /bin/false
> echo 'should not print this'
> return 0
> }
>
> if ! fun; then
> echo 'should catch fault here'
Wrong. '! fun' is executed in a context in which 'set -e' is ignored,
Hello.
Example:
---
#!/bin/bash
set -e -u -E -T
fun()
{
echo 'Execute really bad command:'
/bin/false
echo 'should not print this'
return 0
}
if ! fun; then
echo 'should catch fault here'
fi
fun
---
"s