Re: Meaning of fi at the end of commands if and while
From:
microsuxxor
Subject:
Re: Meaning of fi at the end of commands if and while
Date:
Tue, 31 Dec 2024 18:03:55 +0100
i had lots ago many aliases that had the like part syntaxes in ..
On Tue, Dec 31, 2024, 5:53 PM Chet Ramey <chet.ramey@case.edu> wrote:
> On 12/28/24 11:30 AM, G. Branden Robinson wrote:
> > At 2024-12-28T16:28:17+0100, octavio carnero wrote:
> >> Good morning I,m a beginner with bash , could you explain please the
> >> meaning of función fi at the of scripts with commands if and while.
> >> Sometimes I read endif , does it have the same purpose?
> >
> > That's exactly right.
> >
> > When Stephen Bourne wrote his shell in the late 1970s, he decided to use
> > keywords spelled in reverse to mark the ends of blocks governed by what
> > the Bash manual calls "compound commands".
> >
> > Specifically, he planned on:
> >
> > if/fi
> > case/esac
> > do/od
>
> Bourne was heavily influenced by ALGOL68, on which he spent considerable
> time when he was at Cambridge.
>
> His source code abused the C preprocessor to make C appear more like
> ALGOL. (Some call it `shellgol', but Bourne wrote adb in the same style,
> so others prefer the name `bournegol'.)
>
> For instance:
>
> #define IF if(
> #define THEN ){
> #define ELSE } else {
> #define ELIF } else if (
> #define FI ;}
>
>
> --
> ``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/
>