[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ignoring comments in a 'cat' call

From: Bob Proulx
Subject: Re: ignoring comments in a 'cat' call
Date: Fri, 9 Oct 2009 11:18:23 -0600
User-agent: Mutt/1.5.18 (2008-05-17)

Marc Herbert wrote:
> Bob Proulx a écrit :
> > > Note that if 'cat' didn't exactly reproduce the contents of input on
> > > the output I would consider that a grave bug.
> Well... GNU cat has a number of options, and almost every single one is
> munging the output  :-) 

And they aren't desirable in the program![*]

> > > Instead of using $(cat SOMEFILE) it is better to avoid the extra
> > > process and use $(< SOMEFILE) instead.  It is built into the shell and
> > > is the right way to do that task.
> It is more efficient but I think it is not standard.

Thank you for that information.  I actually hadn't realized that it
was bash only.  However in this context of command line use and being
discussed in bug-bash then in my defense I will say that I think it is
okay to use a bash specific construct there. :-) But I would have said
"built into bash" in that case instead of generically "the shell" and
will try to do so in the future for when mentioning that feature. :-)


[*] See "Program design in the UNIX environment" by Rob Pike and Brian
W. Kernighan for a rationale on this with words such as "But none of
these options are appropriate additions to 'cat'; the reasons get to
the heart of how UNIX programs are designed and why they work well
together. ... 'cat' therefore shouldn't transform its input."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]