What is the difference between operator “=” and “==” in Bash?

后端 未结 2 763
渐次进展
渐次进展 2020-11-29 00:16

It seems that these two operators are pretty much the same - is there a difference? When should I use = and when ==?

2条回答
  •  时光取名叫无心
    2020-11-29 00:42

    There's a subtle difference with regards to POSIX. Excerpt from the Bash reference:

    string1 == string2
    True if the strings are equal. = may be used in place of == for strict POSIX compliance.

提交回复
热议问题