Running scripts from another directory
- by Desmond Hume
Quite often, the script I want to execute is not located in my current working directory and I don't really want to leave it.
Is it a good practice to run scripts (BASH, Perl etc.) from another directory? Will they usually find all the stuff they need to run properly?
If so, what is the best way to run a "distant" script? Is it
. /path/to/script
or
sh /path/to/script
and how to use sudo in such cases? This, for example, doesn't work:
sudo . /path/to/script