tcpdump mailing list archives

how to call tcpudmp rightly in the sh script with tcpdump expression


From: lijx <lijx () nec-as nec com cn>
Date: Mon, 29 Dec 2008 09:30:08 +0800

Hi tcpdump-workers,
  how to call tcpudmp rightly in the sh script with tcpdump expression(filter)?
something confused me a lot.
 
The following call is wrong:
------------------------------------------------------------------

#!/bin/sh
parameters=" -s 96 \'ip host 192.168.0.80\'"
tcpdump  $parameters   -n -w /opt/nec/wbmc/tcpdump/file.tmp


[root@test tcpdump]# ./s.sh
tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: syntax error

------------------------------------------------------------------
while i call this  command directly in the shell terminal,message as the following can be seen:

[root@test tcpdump]# tcpdump -t -s 96 'ip host 192.168.0.80 '   -n -w /opt/nec/wbmc/tcpdump/file.tmp
tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
tcpdump  -s 96 'ip host 192.168.0.80 '   -n -w /opt/nec/wbmc/tcpdump/file.tmp

It seems it runs normally:
[root@test ~]# !ps
ps aux| grep tcpdump
pcap     28708  1.5  0.5  4688 1044 pts/3    S+   07:41   0:00 tcpdump -t -s 96 ip host 192.168.0.80  -n -w 
/opt/nec/wbmc/tcpdump/file.tmp


Thanks,
Li JingXiang

E-Mail: lijx () nec-as nec com cn
=================================================

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: