help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Option execfail does not work in subshells


From: Chet Ramey
Subject: Re: [Help-bash] Option execfail does not work in subshells
Date: Tue, 8 Aug 2017 08:26:05 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 8/8/17 5:51 AM, R. Diez wrote:
> Hi all:
> 
> When I run this test script:
> 
> 
> #!/bin/bash
> 
> test ()
> {
>   shopt -s execfail
>   exec "non-existing-command"
>   echo "This message should therefore always appear."
> }
> 
> test
> (test)
> test &
> 
> 
> 
> The output is:
> 
> $ ./execfail-test.sh
> ./execfail-test.sh: line 6: exec: non-existing-command: not found
> This message should therefore always appear.
> ./execfail-test.sh: line 6: exec: non-existing-command: not found
> ./execfail-test.sh: line 6: exec: non-existing-command: not found
> 
> 
> That is, it looks like execfail is being ignored in the subshells.
> 
> Is that a bug? Or have I missed something?

`execfail' only works when the shell is interactive.  Subshells are
not considered interactive shells.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]