I'm wondering, how come i've got to start my program with ./myapp, when f.ex Git starts without ./ ?!?
What's the difference, is there some option/parameter that I can add or adjust?
Regards Benny
The reason is that, unlike e.g. Windows, most *nixen don't look in the current directory for the executable, only in the PATH. If a program is not installed in any of the directories in the PATH you have to tell the system where it is in the invocation.
Another practical trick:
I create a ~/bin that I put in the path (editing .bashrc).
Then I create symlinks for projects that I'm working on from the bin directory to the binary I want to run. This means the live version of the binary remains in the project dir (for easy editing/testing/updating), but allows executing without path.
I think most of us on Linux do that; it's extremely handy. We run all of our internal tools that way
Another "trick" is to link from
/usr/bin/ (or any "bin" folder, in fact) though that usually requires being
root. It's, for example, how
startlazarus is invoked:
$ ls -l /usr/bin/startlazarus
lrwxrwxrwx 1 root root 38 jul 7 2020 /usr/bin/startlazarus -> /usr/share/lazarus/2.0.10/startlazarus
and it's used mostly for multi-user installs.