DEV Community

Discussion on: Is there a good explainer for bash profiles and paths?

Collapse
 
ferricoxide profile image
Thomas H Jones II • Edited

Bear in mind that multi-element environment variables are processed left-to-right. Which is to say, if you have, say, three commands (shared-libraries, man pages, etc.) that share a common name, the one that appears left-most in the relevant environment-variable is the one that will get invoked. Get familiar with tools like which, ldd, locate and the like. They can help you figure out why things are acting unexpectedly when you invoke a given binary or link to a given library or try to read a given man-page/infodoc/etc.

As to the various profiles... There's rules to how early and in what order they're read and under what circumstances they're read. And, you'll become acutely aware of these rules when you're pulling your hair out wondering "why does this work from my SSH session but doesn't work from a cron-job or a systemd unit??"