[CentOS] Help with at Bash script

Tue Dec 2 20:27:00 UTC 2014
Les Mikesell <lesmikesell at gmail.com>

On Tue, Dec 2, 2014 at 1:19 PM, Alexander Dalloz <ad+lists at uni-x.org> wrote:
> Am 02.12.2014 um 19:05 schrieb James B. Byrne:
>>
>> I am attempting to get a script borrowed from DJB to work on my CentOS-6.6
>> box.  Simplified it looks like this:
>>
>> tcpdump -l -n -e port 53 \
>>    | awk '{if ($14 ~ /A.*?/) print $15}' \
>>    | while read domain ; do echo $domain ; done ;
>>
>> The sticking point is the 'while read' construct.  Run just as 'tcpdum |
>> awk'
>> I get this:
>>
>> english.stackexchange.com.
>> www.urbandictionary.com.
>> www.urbandictionary.com.
>> www.urbandictionary.com.
>> www.urbandictionary.com.
>> api.mywot.com.
>> a.udimg.com.
>> a.udimg.com.
>> fonts.googleapis.com.
>> . . .
>>
>> Run with the 'while read $domain ; do echo ' pipe nothing appears
>> whatsoever.
>> What am I doing wrong?

Works for me as is.  You just have to wait for your pipe buffer to
fill so the output is bursty.

-- 
   Les Mikesell
     lesmikesell at gmail.com