-1

What is the best way to add an executable to one of a computer's $PATH directories? I am writing an installation script, and know that the names of the PATH directories can vary, as do the directories' permissions, so what is the best way to do basically the following:

$ addtopath myexectuable
Christopher Shroba
  • 7,006
  • 8
  • 40
  • 68

1 Answers1

3

Don't add your executable to one of the computer's (or user's) $PATH directory — add your executable in the proper place where it belongs. If someone's path is not right they need to correct it.

Absolutely do not install your program in /bin, /sbin, or /usr/bin — those are reserved for the installed OS.

A single or a small set of programs may be installed in /usr/local/bin

A larger application or suite may be installed in /opt and could have a launcher in /usr/local/bin

I recommend the Filesystem Hierarchy Standard site over the wikipedia article.

Stephen P
  • 14,422
  • 2
  • 43
  • 67