On 2019-10-04 09:15:41 +1000, Chris Angelico wrote:
> On Fri, Oct 4, 2019 at 9:08 AM Cameron Simpson <c...@cskk.id.au> wrote:
> > On 03Oct2019 23:55, Chris Angelico <ros...@gmail.com> wrote:
> > >In the shell, the first two are an empty string, then ':' is a
> > >colon, which introduces a label (the fact that it's in quotes is
> > >irrelevant to the shell). So there's an empty label followed by a
> > >shell comment.
> >
> > No. ":" is a synonym for "true". (Like "[" is a synonym for "test".)
> >
> > There aren't labels in the shell. This is just a dummy "true" command,
> > with a comment.
> 
> My bad. I remember using a leading colon-space as a multi-shell
> comment, and in at least some of them, it's a label

You may actually be onto something here. I came across this interesting[1]
paper:
http://doc.cat-v.org/unix/unix-reader/A.Research.UNIX.Reader.complete.pdf
which mentions:

    GOTO, : (v2 pages 37-38)

        Goto manipulated the standard input to give the illusion of a
    programmable shell (Thompson, v2) The associated : command, which
    thanks to ASCII collating sequence boasted the first page in the
    manual, was a big nop.

It doesn't explicitely say what : was used for, but since it was
associated with goto, it was very likely used to mark a label.

The Bourne shell, introduced with v7, doesn't have goto, but retained :
as a no-op.

        hp

[1] To Unix history afficionados.

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | h...@hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to