Can't get wireshark -R working in unix shell

80 views Asked by At

I would like to get the following wireshark command working in unix shell (bash).

tshark -i any host $IP -R 'udp.port == $PORT'

For some reason the tshark command doesn't see the value in $PORT that in between single quotes, just the variable id $PORT, which then my script fails.

Any info much appreciated.

1

There are 1 answers

1
Mark Fisher On

Single quotes stop environment variables from being evaluated. Change to double quotes to allow the shell to expand the variable. See the following for shell expansion differences

MYPORT=1234
echo '$MYPORT'
echo "$MYPORT"