This question already has an answer here:
- What is the difference between operator “=” and “==” in Bash? 2 answers
In bash
, what's the difference, if any, between the equal and double equal test operators?
[[ "a" = "a" ]] && echo equal || echo not-equal
[[ "a" == "a" ]] && echo equal || echo not-equal
[[ "a" = "b" ]] && echo equal || echo not-equal
[[ "a" == "b" ]] && echo equal || echo not-equal
results in:
equal
equal
not-equal
not-equal