Context: macOS Catalina zSh. The end goal is to be able to setup user scripts so that they can be invoked via CLI at an arbitrary data location.
Question: What is the word (Terminology) for: the terminal command to be invoked from any directory? The correct word / phrase would allow me to Google the subject matter and inch forward to the goal defined below.
Example: the command ls
can be issued from any directory and return output. Likewise when lsusb
was installed with homebrew: lsusb will work from any directory: somehow when lsusb was installed, the system was configured such that it knows where to look to find lsusb
.
Path Variable: I understand that the $PATH variable contains path information:
babygrand:~ user$ echo $PATH
returns
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I suspect that /etc/paths is configures $PATH at startup:
babygrand:~ user$ cat /etc/paths
/usr/local/bin /usr/bin /bin /usr/sbin /sbin
The output paths seem to be a variation of the File System Hierarchy, which poses a similar question to my goal, but not my Terminology question
GOAL: I would like to Google the word / term of the subject matter and learn best practice how to enable a script to be run from any directory. I am faced with a decision as to whether to add another path or to choose an one of the above existing paths that has been already configured into the $PATH variable.
The ability to invoke my script at an arbitrary directory is of significant utility: the script performs work on pdf files, which could be located anywhere in the file system. My script calls an executable to stamp pdf documents.
Clarification: The subject matter is not that of the "subfolder" problem posed at: https://apple.stackexchange.com/q/366127/187540 This is excellent reading as it is somewhat related to directory management.