[Tutor] Making a script part of the terminal

Noah Hall enalicho at gmail.com
Fri May 20 20:07:33 CEST 2011


On Fri, May 20, 2011 at 6:43 PM, michael scott <jigenbakuda at yahoo.com> wrote:
> Okay, my title might be undescriptive, let me try to explain it better. I
> want to take a script I've written and make it usable by typing its name in
> the terminal. Perfect example is the python interpreter. You just type in
> the word python to the terminal and then the interpreter runs. I know other
> programs can do this as well (like mozilla or nautilus or rhythmbox).  So
> how do I make my scripts executable from the terminal?


Since you've mentioned Linux applications, I'm going to guess you mean
on Linux only. This is easy. In Unix scripts, we use something called
a shebang. A shebang is the very first line which basically tells the
terminal what program to use to run the script. For Python, it should
be "#! /usr/bin/python" (or where ever your python interpreter is, you
can find this out by using "which python")

Hope this helps.


More information about the Tutor mailing list