shebang strange thing...

Steve Holden sholden at
Fri Jun 27 03:01:00 CEST 2003

"-" <madsurfer2000 at> wrote in message
news:fef0a228.0306261125.62b83713 at
> bokr at (Bengt Richter) wrote in message
news:<bdcl1d$v43$0 at>...
> > The CR is what you get when you hit the Enter key, so Apple did the most
direct thing
> > in using that key code as an EOL symbol. Perhaps they thought that was
"cleaner" and
> > that they would lead the way to a cleaner standard way of doing things
when they
> > achieved market dominance ;-)
> >
> I think the terminology is not taken from typewriters, but from some
> old printers where you needed both characters to start a new line.
The "old printers" you are thinking of were probably KSR or ASR teletypes,
although similar principles apply to older precursors such as the Creed 5B
teletypewriter (which used a 5-bit code and a shift-locking system to extend
the character set). These did, however, possess a moving print head, while
the "carriage" refers to a platen which moved each time a printable key was
struck. The TAB key moved it until the print position hit a tab stop, and
you could set and clear those stops at will.

> CR moved the print head to the beginning of the line and LF moved the
> paper one line. It can't be compared with a typewriter, where the
> [Enter] key did both operations.

What [Enter] key? In a *proper* typewriter the act of ending one line and
starting another was effected by using the "carriage return lever", which
physically moved the platen back to the left margin, and incidentally also
fed the paper through the platen. Most typewriters could be set to feed one,
one-and-a-half or two lines. Remember, in these devices the printing
position was fixed  (no print head) and the paper had to be moved along each
time a character was printed.

> The Microsoft (other operating  systems also had similar EOF)

EOF means end of file, usually. You seem to be a bit confused. Don't worry,
me too.

> way is actually the "correct" way, since
> the "cursor" needs to move down one line and start at the beginning.

Ah, so Microsoft are "correct" because they choose a system that corresponds
to a typewriting device you don't understand and are probably too young to
remember. I see.

> The Unix way is of cource more elegant, because you have a digital
> computer and not some mechanical device. It doesn't matter if it's CR
> or LF, because both characters only does half of the operation. Apple
> should have chosen LF to preserve compatibillity.

For that matter it might just as well have been ESC or any other arbitrary
character value - clearly a single character will suffice to delimit a line.
I fail to see why Apple should have chosen LF to preserve compatibility with
Unix if Microsoft are "correct". But then I'm just a crotchety old fartbot,
and you're just a mad surfer.

mess-with-old-farts-at-your-peril-ly y'rs  - steve
Steve Holden                        
Python Web Programming       

More information about the Python-list mailing list