shell - How to execute tshark command from bash script -


i trying execute tshark command find packets of particular ip address in bash command follows::

while read client   echo "client adrees:" $client1 cmd="tshark -r \"(ip.src == 10.129.5.192)\" -r 12clients.pcap"   echo $cmd  done < input 

while executing script error follows::

client adrees: 10.129.26.154 tshark -r "(ip.src == 10.129.5.192)" -r 12clients.pcap tshark: read filters specified both "-r" , additional command-line arguments 

thanks in advance... :d

use array variable instead store , execute command - using single string literal double quotes won't interpreted correctly:

# store command tokens in array. # note each word or quoted phrase form separate array element. cmd=( tshark -r "(ip.src == 10.129.5.192)" -r 12clients.pcap )  # invoke command expanded array. # double-quoting prevents shell expansions of elements. "${cmd[@]}" 

Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -