Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0
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'.
--
``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/