0

Why/when should I use || instead of -o in a IF statement in BASH?

e.g. if [ a = a ] || [ b = b ] instead of if [ a = a -o b = b ].

aerijman
  • 2,522
  • 1
  • 22
  • 32
  • 1
    See this related post: [How to represent multiple conditions in a shell if statement?](https://stackoverflow.com/a/3826462/6862601). – codeforester Jan 18 '19 at 00:29
  • I guess the answer is __||__ for portability? – aerijman Jan 18 '19 at 00:44
  • The second example you show [can become problematic](https://github.com/koalaman/shellcheck/wiki/SC2166). – l'L'l Jan 18 '19 at 00:48
  • Where can I read about this in a clear way for a non-expert? The answer to the original question is too complicated for me. – aerijman Jan 18 '19 at 00:50

0 Answers0