[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: erro " too many arguments" ???
From: |
bossonaroesao06 |
Subject: |
Re: erro " too many arguments" ??? |
Date: |
Thu, 29 Nov 2007 15:24:11 -0000 |
User-agent: |
eGroups-EW/0.82 |
Como seria melhor fazer esse teste entao Flavio?
Toda ajuda eh bem vinda!
Obrigado
--- Em address@hidden, "Flavio Junior" <billpp@...>
escreveu
>
> 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 <bossonaroesao06@...>
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:
> >
> > [root@localhost ~]# ./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
> >
> >
>