On Mon, Feb 21, 2022 at 03:27:50PM +0100, sukolyn via wrote:
> $ myFunc() { if test foo; then : ; elif test bar; then : ; else : ; fi;}
>
> $ declare -f myFunc
>
> myFunc ()
> {
> Â Â Â if test foo; then
> Â Â Â Â Â Â Â :;
> Â Â Â else
> Â Â Â Â Â Â Â if test bar; then
> Â Â Â Â Â Â Â Â Â Â Â :;
> Â Â Â Â Â Â Â else
> Â Â Â Â Â Â Â Â Â Â Â :;
> Â Â Â Â Â Â Â fi;
> Â Â Â fi
> }
>
> `else' should be subordonate(?) to main `if' (i.e. `foo' command), not to
> inner if (`bar' command)
Well, they're both equivalent. So the transformation, while surprising,
isn't *wrong*.
I didn't know bash performed that transformation internally, but I can
see it as reasonable.