Operating System - HP-UX
1752554 Members
4628 Online
108788 Solutions
New Discussion юеВ

Re: Chapter III - User's environments and /etc/profile

 
SOLVED
Go to solution
Horia Chirculescu
Honored Contributor
Solution

Re: Chapter III - User's environments and /etc/profile

>if first way- sh, what should set\type in ~/.profile? i checked and found some operators

You have to set up the shell variables, as in

export ORACLE_HOME=...
export ORACLE_BASE=...
export ORACLE_SID=...
and so on.

>2. if the second - bash, what should i do to change shell from sh to bash?

You have to edit the file /etc/passwd

and modify the shell from the posix shell (usr/bin/sh) to bash

And edit the corresponding profile file.

Horia.
Best regards from Romania,
Horia.
Dennis Handly
Acclaimed Contributor

Re: Chapter III - User's environments and /etc/profile

>1. if first way - sh, what should set\type in ~/.profile? I checked and found some operators

(BTW, the correct punctuation is "/", not "\". "\" is used in windows paths and on Unix for escaping.)

If you use a real shell (sh/ksh), ~/.profile should already be set up. You then can customize it the way you want, as Horia suggested.
rustam_2
Super Advisor

Re: Chapter III - User's environments and /etc/profile

Horia and Dennis,
1. i checked passwd. The interpreter is /bin/bash
so why it didnt run the file .bash_pforile? or in passwd must be /usr/bin/bash?

2. my .bash_profile has these values:

# more .bash_profile
MANPATH=/usr/local/share/man:$MANPATH
EDITOR=vi
LESS="-efFKMX"
PS1='\u@\h \W\$ '
# DISPLAY=my_ip:666.0
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=prod
ORACLE_HOSTNAME=oraprod
NLS_LANG=_.AL32UTF8
TMP=/tmp/$LOGNAME
TMPDIR=/tmp/$LOGNAME
#
PATH=/usr/local/bin:$PATH:$ORACLE_HOME/bin

export PATH MANPATH EDITOR LESS ORACLE_HOME ORACLE_SID ORACLE_HOSTNAME TMP TMPDI R NLS_LANG

test -f ~/.aliases && . ~/.aliases
dat=`date +%Y-%m-%d_%H%M`
umask 022

so if i want to sh/ksh i have to copy these values and paste in .profile or ..?

regards,
rustam
Horia Chirculescu
Honored Contributor

Re: Chapter III - User's environments and /etc/profile

Hello,

>1. i checked passwd. The interpreter is /bin/bash
>so why it didnt run the file .bash_pforile?

The only situation when bash does not interpret the profile file, is when the binary itself is called with --noprofile option.

>or in passwd must be /usr/bin/bash?

You must know where your shell binary exists (if it is /bin/bash or /usr/bin/bash). But if you are able to log into the machine as this user, I believe /bin/bash is your binary used as the shell. (You can use `find` or `which` in order to find out the exact location)



>so if i want to sh/ksh i have to copy these values and paste in .profile or ..?

Yes, you must add the following variables into your .profile:

ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=prod
ORACLE_HOSTNAME=oraprod
NLS_LANG=_.AL32UTF8

export ORACLE_HOME ORACLE_SID ORACLE_HOSTNAME NLS_LANG

Horia.
Best regards from Romania,
Horia.
Dennis Handly
Acclaimed Contributor

Re: Chapter III - User's environments and /etc/profile

>1. I checked passwd. The interpreter is /bin/bash
>so why it didn't run the file .bash_profile? or in passwd must be /usr/bin/bash?

Does ~/.bash_profile exist?

Typically there is a tlink that sets /bin to /usr/bin, so both bash paths should be fine.

>export PATH MANPATH EDITOR LESS ...

If you don't have to worry about the Bourne shell, you may want to use:
export MANPATH=/usr/local/share/man:$MANPATH

>if I want to sh/ksh I have to copy these values and paste in .profile or ..?

You can just use ~/.profile and not ~/.bash_profile. Or only put your bash specific stuff in ~/.bash_profile.

rustam_2
Super Advisor

Re: Chapter III - User's environments and /etc/profile

Hi Horia and Dennis,
>> The only situation when bash does not interpret the profile file, is when the binary itself is called with --noprofile option.
how can i change noprofile option?

>>You must know where your shell binary exists (if it is /bin/bash or /usr/bin/bash).
bash exist in both directory.

>>I believe /bin/bash is your binary used as the shell.
How can i check current shell?

>> Does ~/.bash_profile exist?
Yeah, ~/.bash_profile exist and i typed content of this file above.

>> only put your bash specific stuff in ~/.bash_profile.
it was\is first way to solve problem, how?

Dennis Handly
Acclaimed Contributor

Re: Chapter III - User's environments and /etc/profile

>how can I change noprofile option?

It isn't likely that option is used at all.

>bash exist in both directory.

More accurately they ARE the same directory.

>How can I check current shell?

ps -fp $$
Or type an invalid command as see if the shell name is in the error message.

>> only put your bash specific stuff in ~/.bash_profile.
>it was/is first way to solve problem, how?

If you always use ~/.profile, it can work for ksh/sh/base. Then if you need some fancy extra stuff for bash, add it to ~/.bash_profile.
rustam_2
Super Advisor

Re: Chapter III - User's environments and /etc/profile

Hi Dennis,
the command # ps -fp $$
returned me ... COMMAND
... bash
i determined through the $swlist that bash was installed.

I just want to activate bash and use .bash_profile for my user. Are there specific command to activate bash interpreter? In the passwd file i have this argument.
...:/home/oraprd:/bin/bash

Patrick Wallek
Honored Contributor

Re: Chapter III - User's environments and /etc/profile

>>In the passwd file i have this argument.
...:/home/oraprd:/bin/bash

Then that user will use the bash shell when they log in, if bash is really in the /bin directory.

NOTE: In HP-UX /bin is a link to /usr/bin. /bin/bash will work, if the link is present, but /usr/bin/bash is preferred.
rustam_2
Super Advisor

Re: Chapter III - User's environments and /etc/profile

Patrick,
bash exist in /bin, /usr/bin/
when i'm typing wrong command, i get error:
# iffconfig
bash: iffconfig: command not found

so it means my shell is BASH right now. But it doesnt work ~/.profile when i switch
between users.

Regards,
Rustam