The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: John Cowan <cowan@ccil.org>
To: david@kdbarto.org
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] SH script formatting
Date: Tue, 29 Sep 2020 15:29:59 -0400	[thread overview]
Message-ID: <CAD2gp_RnpxnMCKrKxKU2fHmgPRCAvOpNom5QYaDBJ6XYEhvtcQ@mail.gmail.com> (raw)
In-Reply-To: <300084CC-77EA-44D4-9DB1-DC321B9F3F0B@kdbarto.org>

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

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@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

[-- Attachment #2: Type: text/html, Size: 1350 bytes --]

  reply	other threads:[~2020-09-29 19:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 18:42 David Barto
2020-09-29 19:29 ` John Cowan [this message]
2020-09-29 19:15 Norman Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD2gp_RnpxnMCKrKxKU2fHmgPRCAvOpNom5QYaDBJ6XYEhvtcQ@mail.gmail.com \
    --to=cowan@ccil.org \
    --cc=david@kdbarto.org \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).