[lug] Trapping Tcpdump Output

rm at fabula.de rm at fabula.de
Sun Oct 7 12:40:38 MDT 2001


On Sun, Oct 07, 2001 at 12:29:53PM -0600, D. Stimits wrote:
> 
> An expansion on the topic. For bash:
> whatever &1<2 | your_script
> 
> For tcsh/csh:
> whatever |& your_script
> 
> Add this if you want to both log something, and also view it, same time
> (bash version):
> whatever &1<2 | tee logfile
> 
> Variation to view and use script:
> whatever &1<2 | tee logfile | your_script

Redirecting output from _within_ the script might be helpfull sometimes.
Bash allows this with a special neat trick:

 exec 2> mylogfile

I sometimes use this idiom in startup scripts (/etc/init.d stuff mainly)
where i want the output of the script in the logfile of the server i want
to start and not on the console. 

 Ralf



More information about the LUG mailing list