Skip to content

Instantly share code, notes, and snippets.

@brenopolanski
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brenopolanski/ac5a64961fe772da278a to your computer and use it in GitHub Desktop.
Save brenopolanski/ac5a64961fe772da278a to your computer and use it in GitHub Desktop.
Shell - O comando test
Testes em variáveis
-lt Núm. é menor que (LessThan)
-gt Núm. é maior que (GreaterThan)
-le Núm. é menor igual (LessEqual)
-ge Núm. é maior igual (GreaterEqual)
-eq Núm. é igual (EQual)
-ne Núm. é diferente (NotEqual)
= String é igual
!= String é diferente
-n String é não nula
-z String é nula
Testes em arquivos
-d É um diretório
-f É um arquivo normal
-r O arquivo tem permissão de leitura
-s O tamanho do arquivo é maior que zero
-w O arquivo tem permissão de escrita
-nt O arquivo é mais recente (NewerThan)
-ot O arquivo é mais antigo (OlderThan)
-ef O arquivo é o mesmo (EqualFile)
-a E lógico (AND)
-o OU lógico (OR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment