Closed bexelbie closed 5 years ago
According to POSIX, -n
is:
-n string
True if the length of string is non-zero; otherwise, false.
Whilst !
is documented as:
! expression
True if expression is false. False if expression is true.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
In my experience, !
works well across many different shells, but if your experience is that -n
is actually more compatible, we should go with that. Otherwise, I think we should ignore shellcheck on this one.
Oh wait, it's early and I need more coffee... -n
would probably work here, although I remember an edge case which is why I went with !
.. let met dig up my memory.
This should work just fine, thanks!
This is stylistic. If we want to keep this style, we should ignore SC2236