Re: The FreeBSD User Guide

[ Available lists | Index of freebsd-newbies | Month of Jan 1999 | Week of 8 Jan 1999 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Graeme Tait <graeme@echidna.com>
Date
8 Jan 1999 18:22:23
Subject
Re: The FreeBSD User Guide
Message-ID
3696BD61.F5@echidna.com

References to

[ Hide this part ]
Malartre wrote:
>
> Graeme Tait wrote:
> > Certainly "cat filename | more" is redundant: "more filename" is sufficient.
> >
> > --
> > Graeme Tait - Echidna
> Well, you should have seen
> http://www.aei.ca/~malartre/freebsd/more1.html
> And has K. Marsh said, how could I introduce pipe so simply without the
> cat exemple :-)


(Please note, I'm not complaining about your user guide - I think it's great!
However, the cat example struck a nerve!)


There's no need to use cat in a case like that above. I think its best not to
give newbies examples they have to unlearn - I've already been down this path
with cat, having found a similar example in a standard UNIX text. As a beginner,
you get into questions like "well it looks like I could just do 'more filename'
but the book says 'cat filename | more' so I guess there must be a good reason
for that, so I'll follow the book ... but ???".


I would choose a simple case where the pipe is clearly necessary.

For example,

> ls -l | more

to page a file listing of a directory with many files, say /usr/bin . This lets
you introduce the pipe and the paging program.


The example you give uses cat to transfer the contents of a file to stdout, and
pipes that to stdin. AFAIK, since most commands (that can accept input from
stdin) can accept input from a single file directly, this application of cat has
very limited utility. The true uses I've found for cat are (1) creating short
text files directly, as in

> cat > file[input
text
here]
^D

and (2) concatenating files, as in

> cat file1 file2 > bothfiles



--
Graeme Tait - Echidna


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message


Elapsed time: 0.116 seconds