The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: norman@oclsc.org (Norman Wilson)
Subject: [TUHS] Unix taste
Date: Thu, 14 Aug 2014 00:34:18 -0400 (EDT)	[thread overview]
Message-ID: <20140814043418.394291DE382@lignose.oclsc.org> (raw)

Doug McIlroy:

  The single-token rule meant that, if you wanted to supply an
  option to wc in the pipeline
          ls > wc >
  you couldn't write
          ls > wc -l >
  as one would expect, but instead had to write
          ls > "wc -l" >
  Yet a quoted "wc -l" as a bare command or (I suspect) as the
  first command in a pipeline would lead to "command not found".
  What a mess!

======

Then as now, a quoted "wc -l" would be taken by the shell
to be a single world, so

	"wc -l" file

would be a request to find a file named "wc -l" (without
the quotes but with the embedded blank) somewhere in the
search path, and execute it with argv[0] = "wc -l" and
argv[1] = "file".  But the shell's parser bound only the
word following > or < to the operator, so the command had
to be quoted (if it had arguments) to make it a single word.

So in the old syntax, if you needed to quote an argument
of a command that was part of a pipeline but not at the
head, you'd have to embed quotes within quotes; e.g.

	ls > "grep '[0-9]'" >

Decidedly a quick hack, just like the original implementation
of fork(2) (which was, approximately, swap the current process
out, but keep the in-core copy, and give one of the two a new
process ID and process-table entry).  Though unlike the original
fork, the original pipeline syntax was rough enough to be
worth fixing early on.

As a side note, when I was writing my earlier message, I was
going to construct an example using wc -l, until I checked the
manual and discovered that when pipelines were invented wc
didn't yet take options.  I also thought about an example
using grep, except grep hadn't appeared yet either.  Pipelines
(especially once they were attractive and convenient to use)
made a bigger difference than we remember in how commands
worked and which commands were useful.

And of course Doug gets at least as much credit as Ken for
changing our lives with all that.

Norman Wilson
Toronto ON



             reply	other threads:[~2014-08-14  4:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-14  4:34 Norman Wilson [this message]
2014-08-14  4:49 ` A. P. Garcia
  -- strict thread matches above, loose matches on Subject: below --
2014-08-08  3:27 Noel Chiappa
2014-08-08  2:12 Doug McIlroy
2014-08-02 16:07 Ed
2014-08-02 15:38 Doug McIlroy
2014-08-02 16:07 ` John Cowan

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=20140814043418.394291DE382@lignose.oclsc.org \
    --to=norman@oclsc.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).