achrn wrote:W. H. Heydt wrote: a far, far better solution would be to create a 'bin' directory in your home directory--e.g. /home/pi/bin--and put your executable file there.
Why?
Why is a user-specific bin directory better? I'm struggling to see any benefit - other users won't be able to execute a file put there, and if there are no other users then what's the problem with using the system directory? A user-specific bin directory is not, to my mind, equivalent to the /usr/local/bin directory, and a file that should be in the latter will not behave equivalently in the user specific bin directory. I don't see it as 'better' at all, let alone 'far far better'. What are your reasons for considering it better?
I agree. But, FWIW, I do usually go the ~/bin route myself.
Re: the above text. As is often the norm on these forums, the poster way exaggerates for dramatic effect (i.e., overdoes it on the superlatives, much like our current President Superlative). It is not that big of a deal, and it is not "far far" better.
As you note, on a single user system (which 99.999% of all Raspbian Pi systems are), it doesn't matter. The primary advantage of the ~/bin method is that you can do it all without invoking superuser privs. The primary advantage of the /usr/local/bin method is that it is available to all users, not just the 'pi' user. Of course, on a single user system (which 99.999% of all Raspbian Pi systems are), this is a moot point.
In a way, /usr/local/bin is kind of a relic of the past - from when Unix/Linux was a primarily a timesharing system with multiple users. It has evolved over the years to being similar to Windows - a console based, single user system.
Note, incidentally, that it is not really true to say that other users (if there are any) can't execute the program if it is in ~pi/bin. They just have to have ~pi/bin in their PATH (or, of course, use a full path to execute it). And the point is that it is not facetious to say that other users (if there were any) would put ~pi/bin in their PATH - given that it is has been shown many times on this forum that if you do create other user(s), you pretty much have to make them a clone of user 'pi' (all the same groups and a bunch of other things) or stuff just doesn't work (for the new/other user(s)). So, this 'cloning' could well include putting pi's bin directory on their PATH.