Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Jan 1999 21:22:25 -0500
From:      Graeme Tait <graeme@echidna.com>
To:        Malartre <malartre@aei.ca>
Cc:        freebsd-newbies@FreeBSD.ORG
Subject:   Re: The FreeBSD User Guide
Message-ID:  <3696BD61.F5@echidna.com>
References:  <36958774.8135CE68@aei.ca> <3696183A.1FD5@echidna.com> <3696B0D6.E6975FCD@aei.ca>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3696BD61.F5>