the following is the text of my bash script I named script.txt:
#!/bin/sh
direction=${1^^}
filename=$2
system=${3^^}
echo "system = $system"
echo "direction = $direction"
#test for direction = "TX" or "RX"
if [ $direction != "TX" ] & [ $direction != "RX" ]; then
echo "Error - First argument must be 'TX' or 'RX' "
exit 1
fi
#end of script
I enter "bash script tx filename c" in a terminal prompt
The script output is:
system = C
direction = TX
Error - First argument must be 'TX or 'RX'
What is wrong with my if statement? $direction is = "TX"
I also attached my script.txt file
#!/bin/sh
direction=${1^^}
filename=$2
system=${3^^}
echo "system = $system"
echo "direction = $direction"
#test for direction = "TX" or "RX"
if [ $direction != "TX" ] & [ $direction != "RX" ]; then
echo "Error - First argument must be 'TX' or 'RX' "
exit 1
fi
#end of script
I enter "bash script tx filename c" in a terminal prompt
The script output is:
system = C
direction = TX
Error - First argument must be 'TX or 'RX'
What is wrong with my if statement? $direction is = "TX"
I also attached my script.txt file