help-bash
[Top][All Lists]
Advanced

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

Re: declare -f changes 'elif' to 'else if'


From: Alex fxmbsw7 Ratchev
Subject: Re: declare -f changes 'elif' to 'else if'
Date: Mon, 21 Feb 2022 15:57:00 +0100

On Mon, Feb 21, 2022, 15:44 Greg Wooledge <greg@wooledge.org> wrote:

> 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 dont see else if equiv to elif at all, else if expands the if level with
a second if, instead shorter ( as by user specified ), imho bash bug


> I didn't know bash performed that transformation internally, but I can
> see it as reasonable.
>
>


reply via email to

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