how to run python script from Unix Shell?

Donn Cave donn at drizzle.com
Thu Sep 6 23:17:39 EDT 2001


Quoth davidnet800 at yahoo.com (David):

| Can you help to advise how to run python script from Unix Shell?
| What I am doing is:
| 1)chmod +x  script name
| 2)put #!/usr/bin/python   at first line
| 3)when I type the script name under Shell,
| the message is:
| bash: Script name command not found.
|
| Actually, it works if I type:
| python "script name"
|
| But the problem is I want run it by typing "script name"

 3) PATH=$PWD:$PATH

Bash is looking for a file that's (1) executable.  The file needs
the interpreter line (2) to be successfully executed.  Bash will
look for it only in certain places (3).  (You can use "." or ""
in PATH to run commands in the local directory.  I wouldn't do
that, but if you must, put it at the very end of PATH.)

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list