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

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

Re: [shell-script] Como testar se o arquivo é binário


From: Flavio Junior
Subject: Re: [shell-script] Como testar se o arquivo é binário
Date: Tue, 9 Oct 2007 22:57:07 -0300

Binario tu entende como o que ?

Testar se é eXecutavel tu pode testar com o -x (um shell script é executavel
ams é texto)...

Testar se é um formato ELF, que seria um binario propriamente dito tu pode
usar o "file"

wakku@waKKu:~$ grep -q ELF <(file /etc/profile) && echo OK || echo NOK
NOK
wakku@waKKu:~$ grep -q ELF <(file /bin/ls) && echo OK || echo NOK
OK
wakku@waKKu:~$ grep -q 'LSB executable' <(file /bin/ls) && echo OK || echo
NOK
OK
wakku@waKKu:~$ grep -q 'LSB executable' <(file /etc/profile) && echo OK ||
echo NOK
NOK


Eu acho mais recomendavel a opção LSB executable... Existem outros formatos
de binarios "a.out" ou "misc" que sao varios outros q não apareceriam ELF.
Mas tambem não tenho certeza se aparece LSB executable...

Faça o teste e/ou pesquise.


Flávio do Carmo Junior

On 10/9/07, Jeferson <address@hidden> wrote:
>
>   Olá pessoal,
> existe alguma forma de testar se o arquivo é binário? Sei que existe o
> -z para testar se é vazio o -e para testar se existe, mas não sei como
> testar se o arquivo é de acesso binário ou texto.
> Agradeço.
> Jeferson Andrade.
>
>  
>


[As partes desta mensagem que não continham texto foram removidas]



reply via email to

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