[TUHS] Unix taste (Re: terminal - just for fun)

Norman Wilson norman at oclsc.org
Thu Aug 7 08:19:11 AEST 2014

Lyndon Nerenberg:

  Do you still consider '^' the shell's inter-command pipe character?


No.  By the time I first used UNIX, | was well-established as
the official pipeline character; ^ was just a quirky synonym.
I had the impression somehow that ^ was there just to make
life easier on the Model 33 Teletype, which had no | key.

Digging into old manuals, ^ and | appear simultaneously, in
sh(1) in the Fourth Edition.  Pipelines first appeared in
3/e, though with a clumsier syntax (not supported by
any current shell I know): where we would now type
	ls | wc
the original syntax was
	ls > wc >
The trailing > was required to tell the shell to make a pipeline
of the two commands, rather than to redirect output to a file
named wc.  One could of course redirect the final command's
output to a file as well:
	ls > wc > filecount

Even clumsier: where we would now type
	ls | pr -h 'Look at all these files!'
the 3/e shell expected
	ls > "pr -h 'Look at all these files!'" >
because its parser bound > to only the single following word.

The original syntax could be reversed too:
	wc < ls <
The manual implies this was required if the pipeline's
ultimate input came from a file.  Maybe someone with more
energy than I have right now can dig out the source code
and see.

I was originally going to use an example like
	who | grep 'r.*' | wc -l
but the old-style version would be anachronistic.  There
was no grep yet in 3/e, and wc took no arguments.
I do still have the habit of quoting ^ in command arguments,
but that's still necessary on a few current systems; e.g.
/bin/sh on Solaris 10.  Fortunately, that makes it easier
to remember to quote ! as well, something required by the
clumsy command-history mechanism some people like but I don't.
(I usually turn off history but occasionally it gets turned on
by accident anyway.)

Norman Wilson
Toronto ON

More information about the TUHS mailing list