[Tutor] Making a script part of the terminal

Andre' Walker-Loud walksloud at gmail.com
Fri May 20 20:44:45 CEST 2011


Hi Michael,

You have to do three (four) things.

1 - make a directory where you want your executables to live (after you have created them)
on my machine, I copy everything to /usr/local/walkloud/bin/  which requires sudo, but you can put them anywhere in your $PATH


2 - in your .tcshrc or .cshrc or equivalent file (to figure it out, type echo $SHELL to figure out your shell if you have no idea what I am talking about), you must append your path.  eg. with tcshrc (in the .tcshrc file) - the .tcshrc file is located in your $HOME dir.

setenv PATH /usr/local/walkloud/bin:$PATH

3 - if you haven't, in the directory where your script lives
chmod +x your_script

4 - cp your script to this directory in 1-

launch a new terminal and it should work.


Andre



On May 20, 2011, at 11:10 AM, michael scott wrote:

> Thank you for the reply, but thats not exactly what I mean. Perhaps I should say, how do I install a program to my computer, so that I can use it by its self without running it with python. No matter what directory I'm in I can type mozilla in and it runs, no matter what directory I'm in if I type sudo natutilus it will run, no matter what directory I'm in if I type gedit it will run. 
> 
> So I'm trying to achieve this with the script I wrote. I don't know the terminology to ask the question correctly, so forgive me.
>  
> ----
> What is it about you... that intrigues me so?
> 
> 
> From: James Reynolds <eire1130 at gmail.com>
> To: michael scott <jigenbakuda at yahoo.com>
> Cc: tutor at python.org
> Sent: Fri, May 20, 2011 1:57:57 PM
> Subject: Re: [Tutor] Making a script part of the terminal
> 
> We just had a similar question yesterday.
> 
> Just make sure Python is on your PATH. CD to the directory where your file is located and then you can just type "pythonmyfile.py" where myfile is the name of your file.
> 
> 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/729ae68b/attachment.html>


More information about the Tutor mailing list