Reputation: 5646
i am fixing a given shell script and i am getting following error message
line 322: [: ==: unary operator expected
this error is returned from this line.
if [ $4 == "managed?.out" ];then
could someone explain me what makes this error
Also could someone explain what is the purpose of using ? in the"managed?.out"
thanks in advance for any help
Upvotes: 2
Views: 10869
Reputation: 27383
change the if statement to
if [ "$4" == "managed?.out" ];then
The double-quotes are only necessary as you use $4, if your variable would be $string, you would not need them.
should "?" be interpreted as a bash-wildcard? if yes, you need to use
if [[ "$4" == managed?.out ]];then
Upvotes: 1