Say my pwd is at ~/myproject/
and I have a file in ~/myproject/scripts/com/example/module/run_main_script.sh
In vim with ctrlp plugin, I can press Ctrl+P, type run_main_
Enter, I am editing that script.
I want to run that script (with some arguments) in bash. And I don't want to type the full path. Is there any way to do that in bash?
Best Answer
That's what normally the
PATH
variable is for. Though, I would not add your whole home-directory to yourPATH
. Consider adding a dedicated directory (like~/bin
) to add to your path your executables.However, you could add a function to your
~/.bashrc
which allows you to search for and run a script...something like this: