[TUHS] Command-line options

Greg 'groggy' Lehey grog at lemis.com
Sat Mar 26 09:25:16 AEST 2016


On Saturday, 26 March 2016 at  7:29:25 +1000, Warren Toomey wrote:
> On Fri, Mar 25, 2016 at 05:43:08PM +0300, Aharon Robbins wrote:
>> One of Unix's signature hallmarks is its terseness: short command names
>> like mv, ln, cp, cc, ed; short options (a dash and a single letter),
>> programs with just a few, if any, options at all, and short path names:
>> "usr" instead of "user", "src" instead of "source" and so on.
>> I have long theorized that the reason for the short names is that since
>> typing was so physically demanding, it was natural to make the command
>> names (and all the rest) be short and easier to type.  I don't know if
>> this was a conscious decision, but I suspect it more likely to have been
>> an unconscious / natural one.
>
> I'm going to throw in an aside at this point. PDP-7 Unix packed 2
> characters per 18-bit word.

Really?  Most machines of that era used 6 bit characters, so you could
fit 3 in an 18 bit word.  I had hypothesized that that was the reason
for word lengths in increments of 6 bits in those days.

> So, when comparing things, it's easy to compare one word against
> another. I believe this is why command-line options were 2
> characters (e.g. -l, -v, -c, -d) etc.

You've seen the code, of course.  Is that how it was done?

It's interesting to note that large UNIVAC systems in those days had a
similar option syntax.  The 1100 series would add them after a comma.
Here an example from a random command file:

  @ASG,AX    UNIVAC*DVP5.
  @ASG,T     DST1.,F14/88/TRK/88

ASG meant "assign", and the options were after the comma.  I'm a bit
vague about the exact meaning of the options, but they both associated
files with the current job.

The 494 did things slightly differently: there was no comma, and the
options came as a group, so instead of "@ASG,T" you might write
"#ASG T".  This is very reminiscent of some early Unix stuff, such as
tar.  The options were parsed by the shell equivalent (forget the
name) and packed into a single word bitmap.

In passing, it's interesting to note that the initial @ or # were used
to identify a command.  Other systems of the time did similar things.
My guess is that the command prompt in Unix started life as a "here's
your command leadin for free".

I don't think that Unix inherited anything from UNIVAC; it's more
likely that the similarities are indicative of common descent.

Greg
--
Sent from my desktop computer.
Finger grog at FreeBSD.org for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed.  If your Microsoft MUA reports
problems, please read http://tinyurl.com/broken-mua
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20160326/f4b43ad2/attachment.sig>


More information about the TUHS mailing list