• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Adding PATH in Linux

LuckyTaxi

Diamond Member
I am running some scripts under BASH, but it seems my work DIR (/source) isn't listed in the PATH. I would
have to type ./example.sh in order to execute the script. How do I add directories to my PATH?
 
########Answer in Pseudo code mode#########

got to your home directory (i.e. cd ~).

if (you are using bash, sh or korn){
  1. -edit or create a .profile
  1. -add the following line export PATH=$PATH:<your_added_path>
}
else { #if you are using csh, or tcsh
  1. -edit or create a .cshrc
  1. -add the following line setenv PATH "$PATH:<your_added_path>"
}

REMINDER:
Make sure that you don't create a shell script name that already exists on the system, otherwise you will be executing the first one it finds from the PATH, and it might not be the one you want to execute.
 


<< REMINDER:
Make sure that you don't create a shell script name that already exists on the system, otherwise you will be executing the first one it finds from the PATH, and it might not be the one you want to execute.
>>


Actually you can get away with that, not that I recommend it. The $PATH will look in each directory in the order that they're in. So, if you put /home/<user>/bin first, it will look, and execute, anything in that directory first.
 
Back
Top