On Thu, Jul 03, 2003 at 06:54:02PM -0500, David Phillips wrote:
> You wasted your time writing a C program.  Learn to use the standard
> tools:
> 
> ls -1 /var/log | grep -E ^mgetty | xargs rm

Alternatively, you could use find... 

bash$ find /var/log -name mgetty\* -exec rm \{\} \;

BYTES	BINARY
========================
43784      /bin/ls
46444      /bin/grep
11164      /usr/bin/xargs
25352      /bin/rm
49152      /usr/bin/find
3572       rm-mgetty (Karl's program)

We see some huge space savings here, and by looking at the simple for
loop that Karl used, I would venture to say it's pretty efficient with
memory, too.

So, what it all comes down to is conveinence and time.  Being able to
type out a bash commandline with existing tools that pipe into each other
is definitely the UNIX way.

But if you're comfortable with writing little one-timer programs and
scripts, go for it. ;-)  Software evolves.  As you see a need satisfied
by a program, perhaps it can be re-used later.  If so, perhaps it should
be re-written in a more generic manner, or in a manner that lends itself
to piped I/O.  That is UNIX.

-- 
Chad Walstrom <chewie at wookimus.net>           http://www.wookimus.net/
           assert(expired(knowledge)); /* core dump */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20030703/2acf539b/attachment.pgp