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


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

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

Now I'm receiving following output:

/usr/bin/tshark -f "port 5026 and (host or host or host" -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

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 or host or host"

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

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 20 Oct '10, 03:21

question was seen: 6,589 times

last updated: 20 Oct '10, 06:25

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