Operating System - HP-UX
1753970 Members
7191 Online
108811 Solutions
New Discussion юеВ

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

 
SOLVED
Go to solution
rustam_2
Super Advisor

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

Thanks a lot for all of you. You(all) and me solved first problem, i.e. could set mix environments via CLI.

----
>>>> It depends on how many user's want this in their path vs how many don't.

Honestly, i dont know. I just have 2 users, root and oracle. These are just DB server and will not be other services. So should i set these environments for global or just oracle? Could u give me an idea\advice?

P.S. Yesterday, i e-mail to person who used before this server and he answered that there probably might be environments in the bash_profile,or in the bashrc, or in the .profile. How can i check bash_profile and bashrc? (whereis and find didnt help).

Regards,
Rustam
Horia Chirculescu
Honored Contributor

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

> How can i check bash_profile and bashrc? (whereis and find didnt help).

bash_profile can be found on $HOME directory from every user having bash as the shell. I doubt that you are using bash on HP-UX.

bashrc also is related to bash shell.

Those are Linux common shells.

On HP-UX you are using by default bourne shell

This shell is using profile (actually it is .profile) on the same $HOME directory for each user.

man sh-bourne

Horia.
Best regards from Romania,
Horia.
Horia Chirculescu
Honored Contributor

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

"Those are Linux common shells" - > "This is a linux common shell"

I was talking about bash.

Horia.
Best regards from Romania,
Horia.
James R. Ferguson
Acclaimed Contributor

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

Hi:

> Horia: On HP-UX you are using by default bourne shell

No, you are using the Posix shell. The old Bourne shell is long gone. HP-UX uses the Posix shell (see the manpages for 'sh-posix').

Normal users use '/usr/bin/sh' which is compiled with dynamic libraries and minimizes the running memory footprint. The root account has the '/sbin/sh' as the default shell since this is compiled with static libraries that do not require the '/usr' filesystem to be mounted during startup.

Never change 'root's default shell (in '/etc/passwd') from '/sbin/sh' to anything else. To do so may leave you with an un-bootable system.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

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

>I just have 2 users, root and oracle.

Then you just modify ~/.profile of the user that needs those extra PATH directories.

As Horia said, ~ is a shortcut for $HOME.
Horia Chirculescu
Honored Contributor

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

>No, you are using the Posix shell. The old Bourne shell is long gone. HP-UX uses the Posix shell (see the manpages for 'sh-posix').

Thank you for the necessary correction, James.

Like bourne shell, posix is using .profile and /etc/profile.

Anyway, this would lead to the following obvious observation: Should find out what shell is using the oracle user. If it is a bourne, korn or standard posix shell, you should look for profile files (should be $HOME/.profile). If it a csh, then you should look for .cshrc

If the shell is bash then you should look for .bash_profile. But if you did not find /etc/bashrc file, then probably bash is not installed on your system.

Horia.
Best regards from Romania,
Horia.
rustam_2
Super Advisor

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

Thank you, Horia,JRF,Dennis
I read some e-books about setting of user's environment and found out some details.
now i know different between /etc/profile and ~/.profile and when each one runs.

I found out interesting things. All environments which are i set through the CLI and found in ~./bash_profile, not in ~./profile. So ex-DBA set them in ~./bash_profile before. As far as i know ~./bash_profile runs when my shell is bash, right? i checked and found that my current SHELL is SH
SHELL="/sbin/sh"
SHLVL="3"
TERM="vt100"
TZ="WST-5WSTDST"

So should i change my SHELL then do i have to change these environments in another profile file? I mean does SH SHELL is ok? or which shell is suitable for use?
And what does CDE login mean?
Horia Chirculescu
Honored Contributor

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

>All environments which are i set through the CLI and found in ~./bash_profile, not in ~./profile.

One observation: the variables that you set on your current shell

meaning by invoking:

VAR=value
export VAR

would exist only in that shell session. The profile file for the current user would not be affected by only setting a variable in the CLI.


>So ex-DBA set them in ~./bash_profile before.

This means that your ex-DBA used bash as a login shell.


>As far as i know ~./bash_profile runs when my shell is bash, right? i checked and found that my current SHELL is SH
SHELL="/sbin/sh"
SHLVL="3"
TERM="vt100"
TZ="WST-5WSTDST"


So you use the standard posix shell. This means that you must edit .profile for that user.


>So should i change my SHELL then do i have to change these environments in another profile file?


Yes, depending on the shell you use you need to update a different file. As usual, read manual page for the shell you use.


>I mean does SH SHELL is ok? or which shell is suitable for use?

Posix shell would be just fine. Just set the correct environment for your application.

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

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

>about setting of user's environment

(This is typically called setting environment variables.)

>~./bash_profile runs when my shell is bash, right?

Yes.

>I checked and found that my current SHELL is SH: SHELL="/sbin/sh"

No, that just says your login shell is sh.

>So should I change my SHELL then do I have to change these environments in another profile file?

Only if you want $SHELL to be accurate.

>does SH SHELL is ok? or which shell is suitable for use?

Sure, the Posix shell is the default HP-UX shell.

>And what does CDE login mean?

That's what you have when you have a workstation and you use the graphical interface to login.
rustam_2
Super Advisor

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

So during setting environment variables i face dilemma.
Should i change ~/.profile for using SHELL sh or should i change shell to bash for using ~/.bash_profile?

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

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

regards and thank you,
rustam