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?

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

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the 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. – uprego 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. – uprego Dec 3 '13 at 14:53

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.

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