2

Lets say I have a script which creates a file and writes something into it (but could be anything). It could be a script that runs a set of xrandr commands to set a resolution, for example.

Is there a way in which I can create a command (working only on my system) that executes the file, even if the file is not in my working directory?

TellMeWhy
  • 17,964
  • 41
  • 100
  • 142

1 Answers1

4

In Ubuntu, the default .profile adds your $HOME/bin directory to $PATH, assuming the former exists. This means that you can create a bin directory in your home, and any executables in there can be run without specifying the full path, which is what you want.

In the case of a Python script, also make sure that it's executable (chmod u+x blahblah) and it has the proper shebang on the first line, usually:

#!/usr/bin/python
roadmr
  • 34,802