The above error might come when we are using conditional operators to compare two values in a bash script. For example , conisder the following script to compare a user input number with a constant.
The above script when executed will throw the error as listed before. The error in the program is use of $ while taking the input, that is the right way of using the read command is "read
The second possible reason for the error could be not passing two values to compare for the operataor , for example the script below will also throw the same error as the operator "eq" has been given only a single operand.
In the above example, we have missed passing the constant after the comparision opertaor.
Looking in the above two possibilities should fix the error.
This comment has been removed by a blog administrator.
ReplyDelete