Coloque o "$respA" entre aspas..

Mas há formas melhor de fazer esse teste, usando o return code..
Veja o $?


Flavio do Carmo Junior

On Nov 29, 2007 1:20 PM, bossonaroesao06 <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
> Sou iniciante e, shell e to fazendo um script que verifica se minha
>  internet ta pingando e escreve isso em um arquivo de log.
>  Aparentemente ta correto mas encontrei o seguinte erro ao executar:
>
>  [EMAIL PROTECTED] ~]# ./teste.sh
>  ./teste.sh: line 4: [: too many arguments
>
>  Olha o script:
>  #!/bin/bash
>  respA=$(ping -c 1 200.204.0.10 | grep "1 received")
>  dt=$(date)
>  if [ -z $respA ]
>  then
>  echo "nao esta respondendo em : $dt" >> /root/log.txt
>  else
>  echo "esta respondendo em : $dt" >> /root/log.txt
>  fi
>  exit
>
>  Por que deu esse erro na linha do IF?
>  Obrigado
>
>  

Responder a