I have this piece of code:
if(("$op" == "q")); then
which throws out this error:
l5p3.sh: line 10: ((: + == q: syntax error: operand expected (error token is "== q")
what’s the issue? How to compare $op with the letter $q ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
(( ... ))(for arithmetic expressions) is probably not what you want. Check the following:It prints
testin Bash and an error in a strictly bourne-compatible shell likedash.Try the following instead: