[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 17:38:48 +0100 |
On Mon, Feb 21, 2022, 17:18 Chet Ramey <chet.ramey@case.edu> wrote:
> On 2/21/22 9:27 AM, sukolyn via wrote:
> > hi,
> >
> > here's the picture :
> >
> > $ 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)
>
> What does this mean? `elif' is just syntactic sugar for `else if'; they are
> equivalent internally. There's no reason to have a special parse tree
> representation for `elif', so when the internal parse tree gets converted
> back to an external form, you get `else if'.
>
uhu it opens a one deeper if level up, instead of manage to continue the
user specified self, not one deeper
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
>
>