Re: command for checking executability
On Mon, Nov 24, 2008 at 18:03, Can-Hua Chen <chencanhua@fudan.edu.cn> wrote:
> hi, I am writing a bash script, and need a way (preferably a
> shell command) to check whether a binary file can run on
> the platform before hand.
I think you could do this with file or readelf, although I am not
sure if this is the best way.
file /bin/cp
/bin/cp: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
readelf -h /bin/cp
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Intel 80386
Cheers,
Kelly Clowers
Reply to: