Operating System - HP-UX
1751930 Members
5182 Online
108783 Solutions
New Discussion

Re: 11.31 PATH not getting setup from /etc/profile

 
SOLVED
Go to solution
chindi
Respected Contributor

11iv3 PATH not getting setup from /etc/PATH

Hi in 11iv3 PATH not getting setup from /etc/PATH

 

 

 Whem am running env for 1 user am not able to see /etc/PATH contents :

 

$ env|grep -i pat
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/ssh/bin:.

 

 

 

Whereas my /etc/PATH contains ;

root #/var/tmp >cat /etc/PATH
/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/gvsd/bin:/opt/ipf/bin:/opt/nettladm/bin:/opt/fcms/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/sas/bin:/opt/wli/bin:/opt/graphics/common/bin:/opt/hpvm/bin:/opt/atok/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/sec_mgmt/bastille/bin:/opt/caliper/bin:/opt/drd/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/resmon/bin:/opt/firefox:/opt/perf/bin:/usr/contrib/kwdb/bin:/opt/perl_32/bin:/opt/perl_64/bin:/opt/prm/bin:/opt/propplus/bin:/opt/sfm/bin:/etc/cmcluster/scripts/tkit/vtn:/opt/swm/bin:/opt/sec_mgmt/spc/bin:/opt/ssh/bin:/opt/swa/bin:/opt/hpsmh/bin:/opt/thunderbird:/opt/sentinel/bin:/opt/langtools/bin:/opt/wlm/bin:/opt/gwlm/bin:/opt/cfg2html:/home/scripts:/usr/local/bin:/opt/gnome/bin

 

P.S. This thread has been moved from HP-UX>System Administration to  HP-UX > languages. -HP Forum Moderator

 

 

13 REPLIES 13
Torsten.
Acclaimed Contributor

Re: 11iv3 PATH not getting setup from /etc/profile

What shell you are using?

 

If you set PATH in your own profile, don't forget to include $PATH too.


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
chindi
Respected Contributor

Re: 11iv3 PATH not getting setup from /etc/profile

Hi Team ,

 

Please find .profile of 1 user below ;

 

root #/etc >su - tejachau
$ cat .profile

# @(#)B.11.31_LR

# Default user .profile file (/usr/bin/sh initialization).

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

# NOTE: '.' is added to $PATH for compatibility reasons only. This
# default will be changed in a future release. If "." is not
# needed for compatibility it is better to omit this line.
# Please edit .profile according to your site requirements.

# Set up the search paths:
PATH=$PATH:.

# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR

Torsten.
Acclaimed Contributor

Re: 11iv3 PATH not getting setup from /etc/profile

question remains: what shell is in use? bash by chance?

 

Try

 

# sh

# echo $PATH

 

Any difference?


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
chindi
Respected Contributor

Re: 11iv3 PATH not getting setup from /etc/profile

$ sh
$ echo $SHELL
/sbin/sh
$ echo $PATH
/usr/bin:.

Torsten.
Acclaimed Contributor

Re: 11iv3 PATH not getting setup from /etc/profile

Could you please check what is the default shell for this user?


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Dennis Handly
Acclaimed Contributor

Re: 11.31 PATH not getting setup from /etc/PATH

This only works if /etc/profile and ~/.profile work together and haven't been modified too much.  :-)

My old ~/.profile actually reads /etc/PATH.

 

It should also work for the scummy C shell through csh.login.

pooderbill
Valued Contributor

Re: 11iv3 PATH not getting setup from /etc/profile

The 'standard' way to set the PATH variable is in /etc/profile, followed by possible additions or changes in your login profile (.profile). Are you really using /usr/bin/sh? It would be more useful to type ps -f (not ps -ef) to see your currently running shell. If you login with sh and then run ksh or some other shell, the PATH variable may be getting reset.

 

All the PATH setting in /etc/profile and .profile can be destroyed with one command like this:

 

PATH=/usr/bin

 

which has occured somewhere before your .profile starts, which states:

 

PATH=$PATH:.

 

Most likely, /etc/profile has an added line at the bottom that looks like this:

PATH=/usr/bin

 

Start by locating all the PATH words in your /etc/profile:

 

grep PATH /etc/profile

 

If you see something like this:

 

PATH=$(cat /etc/PATH)

 

Then the complete value for /etc/PATH is being set there.

But if you see another PATH=something that does NOT incude $PATH, then the old value is being completely replaced.

NOTE: There may be a 'sourced' script in /etc/profile that is doing this. Look for a line that starts with a period like this:

 

. /someplace/somescript

 

That may be the culprit.

 

 

Dennis Handly
Acclaimed Contributor

Re: 11.31 PATH not getting setup from /etc/profile

>If you see something like this:  PATH=$(cat /etc/PATH)

 

Or more efficiently without that evil cat: PATH=$(< /etc/PATH)

But the ones I see use the deprecated ``:  PATH=`cat /etc/PATH`

chindi
Respected Contributor

Re: 11.31 PATH not getting setup from /etc/profile

root #/ >grep "PATH" /etc/profile


# Modify the variables through /etc/PATH and /etc/MANPATH
PATH=/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin
MANPATH=/usr/share/man:/usr/contrib/man:/usr/local/man
# Insure PATH contains either /usr/bin or /sbin (if /usr/bin is not available).
PATH=$PATH:/sbin
else if [ -r /etc/PATH ]
# Insure that $PATH includes /usr/bin . If /usr/bin is
# present in /etc/PATH then $PATH is set to the contents
# of /etc/PATH. Otherwise, add the contents of /etc/PATH
# to the end of the default $PATH definition above.
-e ":/usr/bin$" /etc/PATH
PATH=`cat /etc/PATH`
PATH=$PATH:`cat /etc/PATH`
export PATH
# Set MANPATH to the contents of /etc/MANPATH, if it exists.
if [ -r /etc/MANPATH ]
MANPATH=`cat /etc/MANPATH`
export MANPATH

 

Hi Guys can i replace /etc/profile online ?

could be a corrupt one ?

One of my junior was trying to install mysql i this host , that also needs to be checked since it has a depot file which uses /etc/profile for its installation .