1

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?

  • 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 Answers1

0

The application/script:

  1. needs to be in one of the directories in PATH (according to FHS you should use /usr/local/bin)

  2. needs to be executable and, if it is an interpreted script, have a shebang (e.g. #!/bin/sh for shell scripts, #!/usr/bin/env python2 for python scripts).

muru
  • 197,895
  • 55
  • 485
  • 740
CameronNemo
  • 1,675