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
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,
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 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
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
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: darwin12.0.0
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='darwin12.0.0' -DCONF_MACHTYPE='i386-apple-darwin12.0.0'
-DCONF_VENDOR='apple' -DLOCALEDIR='/alien/share/loca
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPA
On Tue, 11 Sep 2012, Benoit Vaugon wrote:
...
Description:
Cannot use "case" construction in a "for" loop in a $() sub shell.
Should work but produces parsing error.
Repeat-By:
echo $(for x in whatever; do case y in *) echo 42;; esac; done)
The closing parentheses in the case statement i
On 09/11/12 17:20, quoth Chris F.A. Johnson:
On Tue, 11 Sep 2012, Benoit Vaugon wrote:
...
Description:
Cannot use "case" construction in a "for" loop in a $() sub shell.
Should work but produces parsing error.
Repeat-By:
echo $(for x in whatever; do case y in *) echo 42;; esac; done)
On Tuesday, September 11, 2012 04:40:41 PM Philippe Wang wrote:
> Repeat-By:
> # 1) should raise a parsing error (but it doesn't)
> while break ; true ; do true ; done
This doesn't cause a parsing error in any shell I have to test with. I don't
see why it would.
> # 2) should break the o
On 09/11/2012 08:50 AM, Benoit Vaugon wrote:
> Bash Version: 4.1
> Patch Level: 7
> Repeat-By:
> echo $(for x in whatever; do case y in *) echo 42;; esac; done)
The syntax error is still present in bash 4.2 patchlevel 37:
$ echo $(for x in whatever; do case y in *) echo 42;; esac; done)
bash
On 09/11/2012 03:31 PM, Steven W. Orr wrote:
>>> Fix:
>>> Probably by fixing the bash parser.
>>
>> Balance the parentheses in the case statement:
>>
>> echo $(for x in whatever; do case y in (*) echo 42;; esac; done)
>>
>
> Thanks. I didn't know that the opening paren was optional and was ne
On 9/11/12 10:40 AM, Philippe Wang wrote:
> Bash Version: 4.2
> Patch Level: 0
> Release Status: release
>
> Description:
> "break" keyword inside a while-condition doesn't work as expected : it
> breaks the wrong loop.
>
>
> Repeat-By:
> # 1) should raise a parsing error (but it doesn't)
On Tuesday, September 11, 2012 05:31:36 PM Steven W. Orr wrote:
> On 09/11/12 17:20, quoth Chris F.A. Johnson:
> > On Tue, 11 Sep 2012, Benoit Vaugon wrote:
> > ...
> >> Description:
> >> Cannot use "case" construction in a "for" loop in a $() sub shell.
> >> Should work but produces parsing erro
14 matches
Mail list logo