Significa que o bash avalia 0 (dígito zero) como true ?
Sim.
[ str ]checks whetherstris non-empty. It doesn't matter ifstris0, it will still be evaluated for non-emptyness.
A [0] é verdadeira. Use 'false' em vez
The
testand[builtins evaluate conditional expressions using a set of rules based on the number of arguments.0 arguments
The expression is false.1 argument
The expression is true if and only if the argument is not null.
Leitura Adicional
- Um índice A-Z da linha de comando do Bash para Linux - Uma excelente referência para todas as coisas relacionadas à linha de comando do Bash.
- test - Avalie uma expressão condicional expr.
- Como exatamente "/ bin / [" funciona?