Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to create what the Mac Finder specifies as a "Unix Executable File" and run it in Terminal like any other command instead of creating a .sh or .command file? If so how and where can I learn how to make them? If not, how can I create a .sh file that can take options? For example, with the ls command you can type ls -a to list invisible files as well as visible ones. How can make an executable that will only execute certain code with a -a option?

share|improve this question
1  
(1) Most probably. (2) using the Internet. (3) with a text editor and following the bash documentation and already asked questions. (4) I would do it with Python's argparse whenever possible, but many other APIs exist. You are off-topic. –  galegosimpatico Dec 3 '13 at 14:26
    
I don't see how this is off-topic if this forum is about Unix. Tell me how to get on-topic. In response to 2, this forum IS on the internet. If I ask here it probably means I didn't find helpful answers elsewhere... –  Arc676 Dec 3 '13 at 14:46
    
I meant there are many ways to develop Mac OS software... But the point is, forget about Unix Executable Files and just do what you need. If you just want to create a command wrapper for another command, start finding what you need in the Bash manual at GNU and searching throughout Stack Exchange. If you feel constrained by the command interpreter capabilities get to general purpose programming languages, maybe (maybe) priorizing Python. –  galegosimpatico Dec 3 '13 at 14:53
add comment

closed as too broad by slm, jlliagre, Anthon, terdon, jasonwryan Dec 3 '13 at 16:33

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 2 down vote accepted

Well...all you have to do is basically to chmod your file to have executable permissions. For example if you want to create a shell script, you don't need to have .sh or whatever, you just have to write a text file and save it with any name you want, it doesn't even need to have an extension or you can make your own if you want like .bleh just for the fun of it.

For a shell script you just have to write the header (#!/bin/sh) at the beginning of the file, write your code, save it, change permissions to executable and run it with ./yourFileName.bleh.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.