HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Change in environment variable

 
SOLVED
Go to solution

Change in environment variable

Dear All,
I am using HP-UX 11.23. My path environment variable having these values...

PATH=/oracle/PRD/920_64/bin:.:/home/prdadm:/usr/sap/PRD/SYS/exe/runU:/usr/sap/PRD/SYS/exe/run:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/hparray/bin:/opt/nettladm/bin/opt/fcms/bin:/usr/contrib/kwdb/bin:/usr/bin/X11:/opt/graphics/common/bin:/opt/upgrade/bin:/usr/contib/bin/X11:/opt/ipf/bin:/opt/resmon/bin:/opt/ignite/bin:/opt/sec_mgmt/bastille/bin:/opt/gnome/bin:/ot/mozilla:/opt/wbem/bin:/opt/wbem/sbin:/opt/mx/bin:/opt/sec_mgmt/spc/bin

Now, i want to remove the path /usr/sap/PRD/SYS/exe/runU: from this variable.

Plz tell me the procedure. This is path of prdadm user but in the home directory ie /home/prdadm i didn't found the .* files.

Ankit
10 REPLIES
Nido
Trusted Contributor

Re: Change in environment variable

Ankit Namaste,

Check on one of the location:

1) User's .profile
$grep runU $HOME/.profile

2) under /etc/profile
grep runU /etc/profile

3)
grep runU /etc/PATH

Let me know your findings.

Cheers!!
" Let Villagers Be Happy!! "

Re: Change in environment variable

Thanks Nido,

But i didn't find any output after these searches as my output is ......


prdadm 22> grep runU $HOME/.profile
prdadm 23> grep runU /etc/profile
prdadm 24> grep runU /etc/PATH
prdadm 25> $PATH
/oracle/PRD/920_64/bin:.:/home/prdadm:/usr/sap/PRD/SYS/exe/runU:/usr/sap/PRD/SYS/exe/run:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/fcms/bin:/usr/contrib/kwdb/bin:/usr/bin/X11:/opt/graphics/common/bin:/opt/upgrade/bin:/usr/contrib/bin/X11:/opt/ipf/bin:/opt/resmon/bin:/opt/ignite/bin:/opt/sec_mgmt/bastille/bin:/opt/gnome/bin:/opt/mozilla:/opt/wbem/bin:/opt/wbem/sbin:/opt/mx/bin:/opt/sec_mgmt/spc/bin: Command not found.


Ankit
Steven Schweda
Honored Contributor

Re: Change in environment variable

> Plz tell me the procedure.

To do what? Remove it now? Make sure that
it never gets put in?

Something like this may get it out:

xxx='/usr/sap/PRD/SYS/exe/runU'
export PATH=` echo ":${PATH}:" | sed -e "s|:${xxx}:|:|" -e 's/^://' -e s'/:$//' `

> [...] i didn't found the .* files.

"man your_shell" to see the other places it
might look. "/etc/profile", perhaps?
Nido
Trusted Contributor

Re: Change in environment variable

>>>>>user but in the home directory ie /home/prdadm i didn't found the .* files
>>>> prdadm 22> grep runU $HOME/.profile

Your statements contradicting.

prdadm 22> grep runU $HOME/.profile
if you don't have $HOME/.profile , error message should be "grep: can't open .profile"

Check your .profile it should have some program/script which would be setting the PATH.

Cheers!!
" Let Villagers Be Happy!! "

Re: Change in environment variable

Thanks Nido,
You were right. .* files are exist in $HOME directory. i was seaching by ll command. when i used ll .* command. It shows me some files like .*.

Now my problem is that /usr/sap/PRD/SYS/exe/runU path is showing befor /usr/sap/PRD/SYS/exe/run in PATH environment variable. But when i am checking in script, /usr/sap/PRD/SYS/exe/run is everywhere before /usr/sap/PRD/SYS/exe/runU. Like in script .sapenv_MSLDR.sh ....

MSLDR:prdadm 45> grep runU $HOME/.sapenv_MSLDR.sh
for d in /usr/sap/PRD/SYS/exe/run /usr/sap/PRD/SYS/exe/runU $HOME .; do
LIBPATH=/usr/lib:/lib:/usr/sap/PRD/SYS/exe/run:/usr/sap/PRD/SYS/exe/runU; export LIBPATH
for d in /usr/sap/PRD/SYS/exe/run /usr/sap/PRD/SYS/exe/runU; do
SHLIB_PATH=/usr/sap/PRD/SYS/exe/run:/usr/sap/PRD/SYS/exe/runU; export SHLIB_PATH
for d in /usr/sap/PRD/SYS/exe/run /usr/sap/PRD/SYS/exe/runU; do
LIBPATH=/usr/lib:/lib:/usr/lpp/icli/sbin:/usr/sap/PRD/SYS/exe/run:/usr/sap/PRD/SYS/exe/r
nU; export LIBPATH
for d in /usr/lpp/icli/sbin /usr/sap/PRD/SYS/exe/run /usr/sap/PRD/SYS/exe/runU; do
LD_LIBRARY_PATH=/usr/sap/PRD/SYS/exe/run:/usr/sap/PRD/SYS/exe/runU; export LD_LIBRARY_PA
H
for d in /usr/sap/PRD/SYS/exe/run /usr/sap/PRD/SYS/exe/runU; do

Now, i want that in PATH variable /usr/sap/PRD/SYS/exe/run should be before /usr/sap/PRD/SYS/exe/runU. plz suggest what i should do.

Ankit
Nido
Trusted Contributor
Solution

Re: Change in environment variable

Ankit Bhai,

Simple answer : Don't use the script anymore "$HOME/.sapenv_MSLDR.sh"
Comment this line in your $HOME/.profile

set your PATH variables:

export LIBPATH=/usr/sap/PRD/SYS/exe/run:/usr/sap/PRD/SYS/exe/runU:.

and whatever path you want to add , just add it

As nike says : Just Do it!!

Comprender?

Cheers!!
" Let Villagers Be Happy!! "

Re: Change in environment variable

Thanks Nido,
But i want to change the PATH variable not the addition to the variable as currenly it is ...

PATH=/oracle/PRD/920_64/bin:.:/home/prdadm:/usr/sap/PRD/SYS/exe/runU:/usr/sap/
PRD/SYS/exe/run:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:
/opt/hparray/bin:/opt/nettladm/bin/opt/fcms/bin:/usr/contrib/kwdb/bin:/usr/bin/X11:/opt/
graphics/common/bin:/opt/upgrade/bin:/usr/contib/bin/X11:/opt/ipf/bin:/opt/resmon/bin
:/opt/ignite/bin:/opt/sec_mgmt/bastille/bin:/opt/gnome/bin:/ot/mozilla:/opt/wbem/bin:/o
pt/wbem/sbin:/opt/mx/bin:/opt/sec_mgmt/spc/bin


i want it like ..

PATH=/oracle/PRD/920_64/bin:.:/home/prdadm:/usr/sap/
PRD/SYS/exe/run:/usr/sap/PRD/SYS/exe/runU:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:
/opt/hparray/bin:/opt/nettladm/bin/opt/fcms/bin:/usr/contrib/kwdb/bin:/usr/bin/X11:/opt/
graphics/common/bin:/opt/upgrade/bin:/usr/contib/bin/X11:/opt/ipf/bin:/opt/resmon/bin
:/opt/ignite/bin:/opt/sec_mgmt/bastille/bin:/opt/gnome/bin:/ot/mozilla:/opt/wbem/bin:/o
pt/wbem/sbin:/opt/mx/bin:/opt/sec_mgmt/spc/bin
or this .

PATH=/oracle/PRD/920_64/bin:.:/home/prdadm:/usr/sap/
PRD/SYS/exe/run:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/bin:/opt/perl/bin:
/opt/hparray/bin:/opt/nettladm/bin/opt/fcms/bin:/usr/contrib/kwdb/bin:/usr/bin/X11:/opt/
graphics/common/bin:/opt/upgrade/bin:/usr/contib/bin/X11:/opt/ipf/bin:/opt/resmon/bin
:/opt/ignite/bin:/opt/sec_mgmt/bastille/bin:/opt/gnome/bin:/ot/mozilla:/opt/wbem/bin:/o
pt/wbem/sbin:/opt/mx/bin:/opt/sec_mgmt/spc/bin

Also plz note that it is for user prdadm not for root.

Ankit
OldSchool
Honored Contributor

Re: Change in environment variable

Ankit,

1) "grep" is probably the wrong tool for this job, as it will only tell you if the file it looked at, not any scripts or files it might run/reference which could change the settings

2) all of the previous posts are based on the use of sh / ksh style shell. Given your talking Oracle & SAP, and:
prdadm 22> grep ......
prdadm 23> grep ......
prdadm 24> grep ......
prdadm 25> $PATH

I'd bet money "prdadm" is running "csh". If so, it uses a different set of startup files. From csh man page:
"~/.cshrc
A csh script sourced (executed) at the beginning of execution by each shell. See WARNINGS

~/.login
A csh script sourced (executed) by login shell, after .cshrc at login.

/etc/csh.login
A csh script sourced (executed) before ~/.cshrc and ~/.login when starting a csh login (analogous to /etc/profile in the Bourne shell)."


In any event, check the password file entry for the user in question to find out for certain which shell is in use, and consult the "man" page for that shell. The "FILES" section should point you at the files that shell uses to set it's login environment.

3) After determining which shell / startup files apply, view them to see if they setenv PATH, or what other files / scripts they may reference. You will need to review any referenced scripts as well to determine what they do as well.

Once you locate the scripts that muck about with PATH (and there could be more than one), post your findings....
Bill Hassell
Honored Contributor

Re: Change in environment variable

Long PATH names are a real big problem, including security issues. Start with the global PATH file: /etc/PATH. Trim this down to the bare minimums! PATH is just a simple crutch -- all commands can be run with a full pathname. Unfortunately, some app writers try to be 'helpful' with sourced variable files that include PATH=$PATH...


Bill Hassell, sysadmin

Re: Change in environment variable

Thanks to all of u.

Ankit