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

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

Re: [shell-script] Problema com redirecionamento stderr dpkg-query


From: Paulo Bettega
Subject: Re: [shell-script] Problema com redirecionamento stderr dpkg-query
Date: Sat, 03 Jan 2015 13:01:36 -0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

Olá Vitalino, não tenho um Debian instalado pra testar,
mas essa função não poderia ser mais simples?

function VerificaSafenet {
grep -q ' install' <<<"$(grep -A1 "Package: $1" /var/lib/dpkg/status)" && echo 
0 || echo 1
}

On 02-01-2015 23:12, address@hidden [shell-script] wrote:
Olá pessoal!


function VerificaSafenet {

   VAR=$(grep -A1 "Package: $1" /var/lib/dpkg/status; if [ $? -ne 0 ]; then 
echo '-1'; fi)

   if [ "$VAR" -ne '-1' ]; then

     echo $VAR | grep ' install' > /dev/null 2>&1

     if [ $? -eq 0 ]; then

       echo 0

     else

       echo 1

     fi

   fi

}






[]'s

Vitalino Victor




----------------------------------------------------------------------------------------------------
Enviado por: address@hidden


reply via email to

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