Hi I am trying to make a shell script to accept arguments at startup. The goal I want to achieve is to call a python script which by itself takes arguments. If the arguments are missing, default statement to make them predefined default values. This is the script I am trying to make work:
#!/bin/bash
#Script for calling th e python script sniff.py
while getopts d:D o
do case "$o" in
d) usb_dev="@OPTARG";;
D) console_outp="@OPTARG";;
*) usb_dev=ttyUSB1;
console_outp=INFO;
esac
done
sniff=/home/user/Documents/Wireshark/Sensniff/sniff.py
sudo python $sniff -d "$usb_dev" -D "$console_outp"
sleep 5d
This script of course isn't working. Can you please help me to make this script working?
getopts
– kos Sep 14 '15 at 9:09