[Gllug] redirecting stdout to multiple files

Nix nix at esperi.org.uk
Sun Dec 17 01:16:50 UTC 2006


On 15 Dec 2006, tethys at gmail.com uttered the following:

> On 12/15/06, Ben Fitzgerald <ben_m_f at yahoo.co.uk> wrote:
>
>> I want to be able to have a single line that outputs to stdout and a
>> logfile without spawning a subshell by using a pipe.
>
> Spawning processes under Linux is cheap.

Yeah, it's exec()s you've got to watch out for. You can pretty much
consider $(...) free.

Nonetheless, it's worth going to some effort in long-running or
frequently-run scripts to reduce the number of loops and so forth. sed
and awk can often supplant loops, although I'd not recommend going as
far as Greg Ubben and reimplementing sort(1), dc(1), and much of awk in
sed. (Last I heard he was cracking jokes about implementing perl in
sed, although I think he'd need to add a plugin mechanism first. :) )

-- 
`He accused the FSF of being "something of a hypocrit", which
 shows that he neither understands hypocrisy nor can spell.'
   --- jimmybgood
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list