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

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -