All,

Jerome BENOIT <jgmben...@mailsnare.net>:
> in side a bash script, I would like to test is a given program is
> either a binary file or a script file: is there way to so ?

"file -iL" might be what you're looking for. "-i" for mime type output,
"-L" to follow symbolic links:

    % file -iL config.guess spamassassin unrar  
    config.guess: application/x-shellscript
    spamassassin: application/x-perl
    unrar:        application/x-executable, dynamically linked (uses shared \
    libs), stripped
    % 

Versus:

    % file -L config.guess spamassassin unrar 
    config.guess: Bourne shell script text executable
    spamassassin: perl script text executable
    unrar:        ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), 
dynamically linked (uses shared libs), stripped
    % 

If no -L, then:

    % file spamassassin
    spamassassin: symbolic link to /usr/bin/spamassassin
    % 

Eric
--
Eric De Mund   | Ixian Systems           | Jab: eadix...@jabber.org/main
e...@ixian.com  | 650 Castro St, #120-210 | Y!M: ead0002
ixian.com/ead/ | Mountain View, CA 94041 | ICQ: 811788


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to