To make the scripts executable for users without typing in the full path to the scripts directory you can edit the users bash profile file ".bashrc" and add the path there. However, this gets messy real fast when dealing with lots of users, so we want a way to update the path for every user that logs in. We do this by putting a script in the /etc/profiles.d directory
Note: Scripts in /etc/profile.d are executed whenever a user logs in to a bash session.
Create a file in /etc/profile.d.
sudo vi /etc/profile.d/addpath.sh
Add this line;
PATH=$PATH:/usr/scripts
Log out and log in again and check to see if your path has been updated;
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/scripts
Enjoy!
No comments:
Post a Comment