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(a)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