Making sure /usr/local/bin is in your path

I was working on a linux system that was not automatically adding /usr/local/bin to the PATH which was causing problems trying to invoke local scripts. I found that creating the file “/etc/profile.d/” with the following content:

if [[ ! ":${PATH}:" == *":/usr/local/bin:"* ]]
then PATH="${PATH}:/usr/local/bin"

made sure that it got added to the PATH of all users on login.