Syntax error: operand expected (error token is “+”)

后端 未结 3 527
谎友^
谎友^ 2021-01-04 03:40

I\'m writing a script in bash and I get this error:

./P4.1: line 10: +: syntax error: operand expected (error token is \"+\")

And this is m

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-04 03:58

    Use round parenthesis for numeric computations:

    num1=$((num1 + num2))
    

提交回复
热议问题