input of while loop to come from output of `command`

后端 未结 4 1713
心在旅途
心在旅途 2021-02-04 02:16
#I used to have this, but I don\'t want to write to the disk
#
pcap=\"somefile.pcap\"
tcpdump -n -r $pcap > all.txt
while read line; do  
  ARRAY[$c]=\"$line\"
  c=$(         


        
4条回答
  •  时光取名叫无心
    2021-02-04 03:10

    for line in $(tcpdump -n -r $pcap)  
    do  
     command  
    done 
    

    This isn't exactly doing what I need. But it is close. And Shell compatible. I'm creating HTML tables from the tcpdump output. The for loop makes a new row for each word. It should make a new row for each line (\n ending). Paste bin script01.sh.

提交回复
热议问题