I want to write a Bash script that checks if there is at least one parameter and if there is one, if that parameter is either a 0 or a 1.
This is the script:
#/bin/bash
if (("$#" < 1)) && ( (("$0" != 1)) || (("$0" -ne 0q)) ) ; then
echo this script requires a 1 or 0 as first parameter.
fi
xinput set-prop 12 "Device Enabled" $0
This gives the following errors:
./setTouchpadEnabled: line 2: ((: ./setTouchpadEnabled != 1: syntax error: operand expected (error token is "./setTouchpadEnabled != 1")
./setTouchpadEnabled: line 2: ((: ./setTouchpadEnabled -ne 0q: syntax error: operand expected (error token is "./setTouchpadEnabled -ne 0q")
What am I doing wrong?
sh ./setTouchpadEnabledinstead of using bash.