NetBSD-Users archive

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

Re: is /bin/sh the almquist shell?



> From kre%munnari.OZ.AU@localhost Wed Mar 30 02:55:37 2022
> From: Robert Elz <kre%munnari.OZ.AU@localhost>
> To: Mayuresh Kathe <mayuresh%sdf.org@localhost>
> cc: netbsd-users%netbsd.org@localhost
> Subject: Re: is /bin/sh the almquist shell?
> Content-ID: <4606.1648608622.1%jinx.noi.kre.to@localhost>
>
>     Date:        Tue, 29 Mar 2022 23:34:08 GMT
>     From:        Mayuresh Kathe <mayuresh%sdf.org@localhost>
>     Message-ID:  <202203292334.22TNY8vp027254%sdf.org@localhost>
>
>   | should i start a separate thread asking for information
>   | regarding netbsd's /bin/sh support for recursion?
>
> New thread?   Probably not needed.
>
> To actually answer the question depends exactly what you mean/need.
>
> But as a simple (possibly incorrect) interpretation, the
> original Bourne sh had no functions, so the only way it
> could do anything recursive was by having a script run itself,
> either as a standalone command, or via the '.' command.
>
> All modern shells have functions (they are part of the POSIX
> sh spec) and all shell functions have always supported recursion.
> Not all shells support local vars in functions however, they are
> not in posix.  Without them some recursive techniques can be
> more difficult.
>
> I believe that the original Almquist shell, and all descended
> from it (which includes dash incidentally) support functions
> and local variables.
>
>
> Please read the sh man page.
>
> kre
>

robert, thanks for responding, with the details. helped me.
about sophisticated recursion; it can be achieved using a
"y-combinator".
again, many thanks. :)


Home | Main Index | Thread Index | Old Index