Hi,
I have the following code for a bash script
Code:
#
#!/bin/bash
FILE="-f"
UDP="-u"
V4L="-v"
if [ "$1" == "$FILE" ]
then
echo "-f"
elif [ "$1" == "UDP" ]
then
echo "-u"
elif [ "$1" == "V4L" ]
then
echo "-v"
else
echo "no matches with parameter $1"
fi
when i send -f to the script is displays -f as expected however any other arguments i sent e.g. -u or -v, it goes straight to the else branch e.g
./script.sh -u
results in
no matches with parameter -u
Am I doing something wrong here?
I have also tried putting the first if and then on the same line with a semi-colon after the brace i.e.
if [ "$1" == "$FILE" ]; then
echo "-f"
and leaving the rest unchanged but this still produces the same problem
Thanks