i have the following scenario want to run the following script with manadory and optional arguments inside a bash script
Manadory options are :
filename=""
port=""
optional arguments
type -t [A/B]
balances -b bal
prices -p
./test filename port -t A -b bal
my code i have that won't parse the options is
This is what i have
!/bin/bash
filename=""
port=""
while getopts b:t:p opt
do
case $opt in
b) BAL="${OPTARG}"
if [ "$BAL" == "" ]
then
print_usage $0
else
echo "Balances is " $BAL
fi ;;
t) TYPE="$OPTARG";;
p) PRICES="$OPTARG";;
?) print_usage $0
exit 1;;
esac
done
echo "Balances: "$BAL
echo "Type: "$TYPE
Any ideas