[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:41:28 +0100 |
if one ; then :
elif none ; then :
else : ; fi
one if level with one elif
in your software expanded to two ifs not contiuing 1:1ly
it may exec around the same but it isnt the same code at all
On Mon, Feb 21, 2022, 17:38 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>
>
> 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/
>>
>>