If I want to launch a script (let's say in the home directory I have a file called hi.py) I need to specify the full path: python /home/user/hi.py. But when I want to use mkdir I can simply say: mkdir folder_name. How can I do the same thing whit hi.py?
Asked
Active
Viewed 95 times
1
user284659
- 328
- 1
- 3
- 10
-
You mean like `./hi.py`? – Seth Nov 23 '14 at 18:45
-
Yes but that will work only if I'm my working directory is /home/user. I want to be able to do that from everywere – user284659 Nov 23 '14 at 18:47
-
like when I use javac I don't need to go to /bin and do a ./javac I can do that from every working directory – user284659 Nov 23 '14 at 18:48
-
See http://askubuntu.com/questions/451902/add-to-path-only-sh-file-not-a-dir, http://askubuntu.com/questions/440691/add-a-binary-to-my-path, and http://askubuntu.com/questions/60218/how-to-add-a-directory-to-my-path – Seth Nov 23 '14 at 18:51
1 Answers
0
The application/script:
needs to be in one of the directories in PATH (according to FHS you should use
/usr/local/bin)needs to be executable and, if it is an interpreted script, have a shebang (e.g.
#!/bin/shfor shell scripts,#!/usr/bin/env python2for python scripts).
muru
- 193,181
- 53
- 473
- 722
CameronNemo
- 1,675
- 13
- 13