bug-bash
[Top][All Lists]
Advanced

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

Re: Bash will continue executing main code path instead of current code


From: Chet Ramey
Subject: Re: Bash will continue executing main code path instead of current code path on error
Date: Thu, 18 Apr 2019 15:34:26 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/18/19 11:32 AM, Thomas Deutschmann wrote:

> Actual result:
> ==============
> bash-test.sh: line 5: bar=${${foo}_blah}: bad substitution
> Rest of the script
> 
> 
> Expected result:
> ================
> bash-test.sh: line 5: bar=${${foo}_blah}: bad substitution
> I run after the failing_function!
> Rest of the script
> 
> Is my expectation wrong? I am really wondering that the script will
> continue but not in the current if clause...

On a substitution (expansion) error, bash will either exit the shell
(posix mode in a non-interactive shell, since POSIX requires this), or
return to the top level of execution. It doesn't matter whether the shell
is interactive or not. Bash has always behaved this way. In no cases will
it simply continue with the current command.

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



reply via email to

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