I have a problem with a bash script on raspberry pi:
x='gpio -g read 22'
if [ $x -ge 1 ]
then
gpio -g write 23 1
fi
The error is integer expression expected
. Why?
I have a problem with a bash script on raspberry pi:
The error is |
||||
|
That's because you are checking whether the string You don't explain what you are trying to do but I'm guessing you want to compare the output of the
Or, more simply:
The assignment |
|||
|
The above answer works most of the time but take the following script:
Instead of cleanly echoing one of the above choices, it does the following:
To make the script work as expected (e.g. compare values as strings) you need to change the comparison to:
|
||||
|