[Tutor] Making a script part of the terminal

ian douglas ian.douglas at iandouglas.com
Fri May 20 20:29:30 CEST 2011


To expand further, some distributions of Linux set a 'bin' path under 
your home folder as part of your native PATH, even if it doesn't exist.

So if your Linux username is, say, "mscott", see if "echo $PATH" already 
includes something like "/home/mscott/bin" in the path already. If so, 
simply create a bin folder:

mkdir ~/bin

and then place your Python scripts within that folder, and follow 
Edgar's other advice about adding #!/usr/local/bin/python and using 
"chmod +x filename.py" etc.

If you're on a non-Linux platform, I'm sure others can provide further help.

-id



On 05/20/2011 11:03 AM, Edgar Almonte wrote:
> hey ! i can answer that !
>
> birst in the fist line of you script put something like this
>
> #!/usr/local/bin/python
>
> change the path for where you have python ( try using 'whereis python' )
>
> sencond make the file executable add the +x attribute ( using chmod )
>
> third  put the script in some place and and that path to the PATH
> enviroment variable.
>
> good luck
>
>
> On Fri, May 20, 2011 at 1: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?
>>
>> ----
>> What is it about you... that intrigues me so?
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110520/08f0c7a3/attachment.html>


More information about the Tutor mailing list