Check whether one number equals another number in bash

后端 未结 4 1808
庸人自扰
庸人自扰 2020-12-24 07:02

I\'ve been trying to compare whether two numbers in Bash are equal (and print a message if they are equal), but I\'m getting some strange error messages for this simple prog

4条回答
  •  悲哀的现实
    2020-12-24 07:40

    • the spaces are mandatory in the [ ] expression, so

      if [ $x == 3 ]; then

    • you need a sigill on variables in the [ ] tests

提交回复
热议问题