Wednesday, January 19, 2011

Church Street Orlando New Years

BASH: read and change the value of the PATH variable

In BASH, the PATH environment variable contains the list of directories that look BASH commands typed by us, that we want to execute programs (of course those who do not type preceded by './').

A fairly typical example of the value associated with PATH is:
/ bin: / sbin: / usr / bin: / usr / sbin .
To get the value of the PATH variable on your system, simply run the following command: echo $ PATH
 
(we can print every environment variable in this way).

In the following examples we want to add the path / usr / local / bin to your PATH.
To completely replace the value already defined you can simply do this:
 PATH = / usr / local / bin 

More often add some useful new route to those already defined:
 PATH =% PATH: / usr / local / bin 

In general, all the environment variables can be modified in this way, but you must Use extreme care because modifying them improperly you risk corrupting the system and undermine its normal and proper operation.

To permanently change for all users and the value of the variable you must add the following two lines in the file / etc / profile (preferably before the line containing the string "umask"): PATH =
 % PATH: / usr / local / bin export PATH 

0 comments:

Post a Comment