Hi,

Test script:
============
#!/bin/bash
failing_function() {
    local foo=${1}
    # force bad substitution
    local bar=${${foo}_blah}

    echo "You will never see this text!"
}

if [[ 1 -eq 1 ]]
then
    # Current code path
    failing_function
    echo "I run after the failing_function!"
else
    # Alternative code path
    echo "Will never run."
fi

# Main code path
echo "Rest of the script"


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...

Tested with:
> GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)


-- 
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5

Reply via email to