[TUHS] SH script formatting

John Cowan cowan at ccil.org
Wed Sep 30 05:29:59 AEST 2020


There seems to have been a migration over time from the first format to the
second, perhaps a result of C programmers not having a keyword "then",
which Bourne shells (following Algol 68) require.  I don't think it matters
much.

On Tue, Sep 29, 2020 at 2:52 PM David Barto <david at kdbarto.org> wrote:

> In a brief discussion with a coworker today the question of formatting
> shell scripts came up.
>
> I believed that in the past the preferred format (if there ever were any
> such thing) was
>
> if [ test ]
> then
>         statements
> else
>         statements
> fi
>
> I can find nothing specific to back this up. More appropriate for COFF
> maybe would
> be a discussion of what format is better
>
> if [ test ]; then
>         statements
> else
>         statements
> fi
>
> or the above.
>
> No intention to start any kind of flame war about which is better, just
> want to see
> if there is any historical option for one over the other.
>
>         David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200929/bcad5e18/attachment.htm>


More information about the TUHS mailing list