unix executable file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting unix executable file
# 1  
Old 08-21-2009
unix executable file

Hi - How can I find out under sh whitch file is an unix executable file? Need it for an software inventory. Thanks in advance. Regards - Lazybaer
# 2  
Old 08-21-2009
Code:
file filename

The file command indentifies file types based mostly on the magic number
# 3  
Old 08-21-2009
thanks jim
# 4  
Old 08-21-2009
Reading the question another way:

Code:
Within shell you can test whether a file is executable.

if [ -x "${filename}" ]
then
      echo "This file is executable : ${filename}"
fi

Code:
Using "find" you can find all the files which are executable. For example.

find . -type f \( -perm -000100 -o -perm -000010 -o -perm -000001 \) -exec ls -ald {} \;

# 5  
Old 08-21-2009
thanks methyl, very useful
# 6  
Old 08-21-2009
Code:
if test -x filename
then
echo Executable.
else
echo Not executable.
fi

# 7  
Old 08-21-2009
I am becoming concerned about the number of decidely weird commands on from scripterworld which are filtering onto this site. From the above link about "find" we see:

find . -ipath "./SCRIPTS/scripter*" -print

Which version of unix will accept this command?
There is a naive belief on this site that all unix and Linux commands are common.

Btw, this is not commercial quality script:

Code:
if test -x filename
then
echo Executable.
else
echo Not executable.
fi


Last edited by methyl; 08-21-2009 at 06:38 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Plist to Unix Executable

I'm using an old conversion method for converting a plist into an XML file, but that's not what I'm needing just via terminal now. What I'm looking for is an answer to convert a plist file into an executable. I'd like to import it into Casper and have the JSS push it out onto an image. In this... (6 Replies)
Discussion started by: unimachead
6 Replies

2. Shell Programming and Scripting

Write an executable file in Unix

Hi, I want to write an executable file in unix env to go to a particular path instead of always typing the long path cd /app/oracle/product/10.2.0/Db_1/scripts/prejib/sample. I have tried with the below script in but not working . please help me bash-3.00$ cat a.sh #!/bin/sh ... (3 Replies)
Discussion started by: prejib
3 Replies

3. UNIX for Advanced & Expert Users

How can i read a non text file in unix - ELF-64 executable object file - IA64

The binary file is ELF-64 executable object file - IA64. How i know that the source is Is there any comamnd in unix i can read these kind of files or use a thirty party software? Thanks for your help (8 Replies)
Discussion started by: alexcol
8 Replies

4. OS X (Apple)

What's The Easiest Route To Creating A Unix Executable File for Terminal?

I've seen the executable open in the application OmniOutliner, can I create an executable with this app? I'd like to be able to create the unix executable and insert it into terminal, but I'm not sure if the Omni app will allow me to create it. Any one have any ideas or possibly familiar with... (10 Replies)
Discussion started by: unimachead
10 Replies

5. UNIX for Dummies Questions & Answers

Cannot run UNIX executable !

I have installed the Darwin Calendar Server on my Mac and got it working. To start the server I open a Finder window on my mac and click the UNIX executable called RUN. In order to start the server automatically on bootup I used LINGON to add a startup Daemon to call "RUN -d". When I reboot... (6 Replies)
Discussion started by: thylacine
6 Replies

6. UNIX for Dummies Questions & Answers

Making UNIX script executable

Hello, I am very new to UNIX and I have been learning about writing scripts and making them executable. I created a script called myscript. It has three lines: #! /bin/sh # This is my first shell script echo friendsjustfriends Now I try to run it using the sh command and it works Next I... (4 Replies)
Discussion started by: rohitx
4 Replies

7. Filesystems, Disks and Memory

unix executable file problem on MAC OSX ??? please help

I've got this problem. My computers and external hard drives are converting many of my files to a Unix Executable File which has a grey terminal looking icon. I don't understand what is causing this to happen. It is happening to a large number of my image file of different formats and also... (1 Reply)
Discussion started by: chadb
1 Replies

8. UNIX for Dummies Questions & Answers

How to convert Unix executable file to Tiff

Hi, I know nothing about Unix. Recently received image files from a client. Mac sees it as a Unix executable file. How do I convert these files to Tiff? Thanks for helping. (1 Reply)
Discussion started by: Pet Teoh
1 Replies

9. OS X (Apple)

Converting Unix executable files

I loaded OS X Panther on my Mac G4 and found that many files previously saved as Word or Word Perfect files were inadventently converted to Unix executable files. When I try to read these in Word, it cannot recognize or translate the file properly. Does anyone know how to translate these files? Is... (4 Replies)
Discussion started by: Steven Greenber
4 Replies

10. OS X (Apple)

Cannot translate Unix executable files

Help!! I loaded OS X Panther on my Mac G4 and found that many files previously saved as txt files were inadventently converted to Unix executable files. When I try to read these in Word, the Word filters cannot recognize or translate the file properly. Does anyone know how to translate these files?... (1 Reply)
Discussion started by: Steven Greenber
1 Replies
Login or Register to Ask a Question

Featured Tech Videos