Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Sep 1995 13:05:21 +0100
From:      Simon Marlow <simonm@dcs.gla.ac.uk>
To:        Wolfram Schneider <wosch@cs.tu-berlin.de>
Cc:        "Garrett A. Wollman" <wollman@lcs.mit.edu>, current@freebsd.org
Subject:   Re: from(1) 
Message-ID:  <199509221206.FAA27393@freefall.freebsd.org>
In-Reply-To: Your message of "Thu, 21 Sep 1995 15:14:51 %2B0200."             <199509211314.PAA05392@caramba.cs.tu-berlin.de> 

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

Wolfram Schneider writes:
> Garrett A. Wollman writes:
> ><<On Wed, 20 Sep 1995 19:37:08 +0200, Wolfram Schneider <wosch@cs.tu-berlin.
> de> said:
> >
> >> 	- Option '-c' print a count of matching lines
> >
> >Use wc(1).
> 
> 
> An option is better than a pipe

I disagree entirely.  The generality provided by pipes and pipe
combinators far outweighs the slight performance gain by implementing
the options directly.  How many other programs are you going to add
'-c' to?  What about the programs where '-c' is already taken, and you
have to use an inconsistent flag?

In Un*x, to count lines, one uses wc(1).

> 	a) in a perl script, a pipe force system to use sh -c 
> 	   instead exec/fork

If efficiency is that important, the Perl script should be counting
the lines itself.  This is trivial in Perl.

> 	b) for aliases
> 
>            alias fb='from -tcs owner-freebsd-security'
> 
> 	   is simpler than [for bash]
> 	   fb () {
> 		from -tcs owner-freebsd-security "$@" | wc -l
>            }
> 	   most people forget the "$@"

A valid point, but this is a shell problem and not worth sacrificing
the philosophy of an operating system for.

Cheers,
	Simon

--
Simon Marlow						 simonm@dcs.gla.ac.uk
Research Assistant			    http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key



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