Reputation: 13477
I'd like to cheick that the one of two options are set: either the bin
to true
, or str
is provided:
bin=false; str=; if $bin -o [ -n "$str" ]; then echo yes; fi
doesn't echo
es anything, as it should be, but:
bin=false; str='str'; if $bin -o [ -n "$str" ]; then echo yes; fi
doesn't echo either - while it should. What do I do wrong?
Upvotes: 0
Views: 74
Reputation: 241918
Your -o
option is getting passed to false
. You need ||
:
bin=false; str=; if $bin || [ -n "$str" ]; then echo yes; fi
bin=false; str='str'; if $bin || [ -n "$str" ]; then echo yes; fi
Upvotes: 1