Running scripts in your shell without specifying the absolute path
If you want to run a script (or any executable file) in your shell you have to specify the absolute path to it. This might not always be a desired way of doing it, especially if you often use the script or if you want to call it from a launcher like Rofi or dmenu.
To make things simpler you can add a
$PATH to your shell. You can then call the script just by it’s name without the path to it. Like
example.sh instead of
Add this to your configuration file (
~/.zshrc for zsh and
~/.bashrc for Bash):
export PATH="<your path>:$PATH"
You can use any folder. I prefer having my scripts in the folder
Resource your configuration file (or just restart the terminal emulator):
$ source ~/.bashrc
$ source ~/.zshrc
You can now call your script only by its name if it’s stored in
~/Scripts or whatever folder you specified.