-1

I am trying to run tshark in a perl script, simply by doing the following -

my $filter = "port 68 or 67";
my $capture = "tshark -i eth0 -f $filter -a duration:120 -w pcapture.pcap&";
system($capture);

This code is not starting the tshark process. Any changes recommended?

user1060517
  • 355
  • 1
  • 5
  • 17

1 Answers1

0

Assuming port 68 or 67 is a legal value for -f, you need quotes to treat it as one entity (a value which contains whitespace):

my $filter = "port 68 or 67";
my $capture = "tshark -i eth0 -f '$filter' -a duration:120 -w pcapture.pcap&";
system($capture);
toolic
  • 57,801
  • 17
  • 75
  • 117