starting tshark with given parameter from bash script [closed]

asked 2021-05-08 18:05:18 +0000

sporex gravatar image

updated 2021-05-08 18:24:59 +0000

grahamb gravatar image

Hello, I am launching tshark with the following cmd line on a RPi with Debian Jessie without any problem:

tshark -i "eth0" -f "port 8000" -w /tmp/x.pcap

Now I want to pack this in a bash script called shark0 so that inexperienced users can take captures and send me the file.

The script looks like that:

#!/bin/sh
shark="tshark -i "'"eth0"'" -f "'"port 8000"'" -w /tmp/x.pcap"
echo $shark
$shark &

Unluckily this script only opens the tshark options manual, thus I suppose something must be wrong with the parameters. When I copy the output of the echo $shark line to the command prompt, tshark executes normally. I have installed tshark the default way, answering the window that pops up with "YES" and adding user pi to the group:

sudo usermod -a -G wireshark pi

And I am not running the script as root!

Thx for advice

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by grahamb
close date 2021-05-08 18:29:07.554597

Comments

@administrator : Thank you for re-shaping my text.

sporex gravatar imagesporex ( 2021-05-08 18:28:36 +0000 )edit

This isn't a Wireshark problem, but is a bash scripting issue. You should use an appropriate support forum for bash issues, e.g. a Stack Exchange question here.

grahamb gravatar imagegrahamb ( 2021-05-08 18:28:55 +0000 )edit

absolutely right. But you pointed me in the right direction. Thx

sporex gravatar imagesporex ( 2021-05-08 18:51:37 +0000 )edit