After years of experience I wouldn't use "file" for anything I needed
to work reliably.

If the test is really ELF or not ELF, how about detecting the ELF
header magic directly?

$ if [[ $(dd if="/bin/ls" status=none bs=4 count=1) == $'\x7fELF' ]]; then echo 
elf ; else echo not-elf; fi
elf

$ if [[ $(dd if="/etc/passwd" status=none bs=4 count=1) == $'\x7fELF' ]]; then 
echo elf ; else echo not-elf; fi
not-elf

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to