shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [shell-script] Verificar se existe arquivos


From: MrBiTs
Subject: RE: [shell-script] Verificar se existe arquivos
Date: Wed, 1 Dec 2004 09:30:17 -0200

<QUOTE>
Estou finalizando um script e quero que ele verifique dentro de um diretório
se existe arquivos maiores que 10 k e após crie um diretório.
Estou fazendo assim : 

  if test find /home/ -size +10c = true
   then
    xxxxxxxx
      else 
       xxxxxxxxx
        fi

Mas não esta funcionando. Alguem tem uma dica.
</QUOTE>

Alguns problemas ai:

1) Nao estar funcionando é absolutamente subjetivo :)
2) esse if test retorna um erro que diz "test: too many arguments". Esse
deve ser o seu "nao esta funcionando"
3) a construcao test comando = true é desnecessaria. Voce poderia fazer if
comando , simplesmente. Entrentanto, se vc construir algo como if find
/home/ -size +10c ; then echo OK ; else echo NOK ; fi voce terá ALEM do seu
resultado, a listagem do retorno do comando find. Entao, um bom caminho ai
seria:

if find /home/ -size +10c > /dev/null ; then echo OK ; else echo Nao Ok ; fi


[]'s



reply via email to

[Prev in Thread] Current Thread [Next in Thread]