This is our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Hi,

I have a little problem when starting tshark out of a bash-script. Here a short part from the script:

BIN="/usr/bin/tshark"
OPTS=" -f \"port 5026 and (host 10.65.27.138 or host 10.65.27.137 or host 10.65.27.139)\" -a duration:10 -i eth1 -n -q -w /data/traces/files/test2.pcap"
echo $BIN $OPTS
$BIN $OPTS

Now I'm receiving following output:

/usr/bin/tshark -f "port 5026 and (host 10.65.27.138 or host 10.65.27.137 or host 10.65.27.139)" -a duration:10 -i eth1 -n -q -w /data/traces/files/tma_ffm_1_smpp_hsbu1a1/test2.pcap
tshark: Capture filters were specified both with "-f" and with additional command-line arguments

When starting tshark directly from the bash with the output of "echo $BIN $OPTS" everything is working fine. I've tried several versions of declaring $OPTS like

  • OPTS=" -f "filters" "
  • OPTS=' -f "filters" '
  • OPTS=" -f 'filter' "

but all with the same result as mentioned above. Tested with tshark 0.99.6, 1.0.5 and 1.2.8

Hope anyone can help me again ;)

BR Sascha

asked 20 Oct '10, 03:21

Sascha's gravatar image

Sascha
6223
accept rate: 100%


Hi again,

dont think it's a good solution, but I found an usable workaround:

OPTS=" -b duration:900 -i eth2 -n -q -w /data/traces/files/tma_ffm_1_smpp_hsbu1b1/tma_ffm_1_smpp_hsbu1b1.pcap port 5026 and (host 10.65.27.138 or host 10.65.27.137 or host 10.65.27.139)"

As all the last arguments are interpreted as capture filter, this is working.

If anybody knows a better way, please let me know.

BR Sascha

permanent link

answered 20 Oct '10, 06:25

Sascha's gravatar image

Sascha
6223
accept rate: 100%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×832
×184
×31

question asked: 20 Oct '10, 03:21

question was seen: 6,137 times

last updated: 20 Oct '10, 06:25

p​o​w​e​r​e​d by O​S​Q​A