1846626 Members
1760 Online
110256 Solutions
New Discussion

Re: Path variable

 
Marcelo De Florio
Frequent Advisor

Path variable

Hi, I need a put path variable for all users, the eg: PATH=:/usr/bin:/usr/ccs/bin:/usr/contrib/bin (in the /etc/profile)

I need put before /usr/contrib/bin, /opt/perl5/bin and then the line is:
PATH=:/usr/bin:/usr/ccs/bin:/opt/perl5/bin:/usr/contrib/bin
but I execute the command of /opt/perl5/bin in shell, the result is :
the command executed is in /usr/contrib/bin

regards.
MDF


2 REPLIES 2
Alan Riggs
Honored Contributor

Re: Path variable

Have you logged off (or resourced teh /etc/profile) in between editing and testing?
If not, that is almost certainly the problem.

An easy way to test what binary will be executed under any given environment is with the type command (or whence). ex:
# type ls
ls is a tracked alias for /usr/bin/ls

Otherwise, your logic is correct. The PATH variale will be searched from beginning to end. Placing the path you want accessed earlier in the assignment should make it the path accessed.
Andreas Voss
Honored Contributor

Re: Path variable

Hi,

for global setting of the PATH variable edit the file /etc/PATH

Regards