Home

How to modify a local PATH to include another entry to executable programs

webmaster's picture

In this article we explain how to star any program from the command line without entering the entire path. In our case the instalation of openbravo 3.0 database set in another folder the path to run a psql program that allow us to start the postgrep sql command line. We need to include the folder in the global PATH to run this program without be in the same folder.

When we installed the Openbravo ERP 3.0 it installed the postgrep database and executables files in /usr/lib/postgresql/9.1/bin folder. We need to include this folder  in a global PATH to run all postgresql command without be in the same folder.

Asumming thaAssuming that you are logged like superuser

To view how is PATH configurated run this command in the command line:

root@VLSERVER2: echo $PATH

Then we obtain the way that the operating system is searched executables files or programs files. Type this command to include a new /usr/lib/postgrepsql/9.1/bin in the golbal PATH:

root@VLSERVER2: export PATH=$PATH:/usr/lib/postgrepsql/9.1/bin

But this is only temporaly.

To take forever this new configuration you can put your script/application in any of these (assuming you have write access). You can of course add to the PATH env. variable in the .bashrc script using:

# set PATH so it includes /usr/lib/postgrepsql/9.1/bin if it exists
if [ -d /usr/lib/postgrepsql/9.1/bin ] ; then
PATH=/usr/lib/postgrepsql/9.1/bin:"${PATH}"
fi

You have to login again to get this to be added to path. This new PATH is only valid for a root user.

To set the new PATH for all users you may include the new line in /etc/environment file

 

Fuente: 

Centro Práctico - LEMURSOLUTION

Contacto: 
webmaster