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/local.sh” with the following content:

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

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

Leave a Reply

Your email address will not be published. Required fields are marked *