cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
benjamin_jaton
Level 3

Unix - Set System Environment Variable shouldn't use ~/.profile

Hi,

From the doc:
"Set environment variables on the end user’s system. Compatible with Windows and Unix only. Unix Bash, sh, ksh, zsh, csh, and tcsh shells are supported."

Under Ubuntu and RedHat with Bash, the task defines my environment variable into ~/.profile.

From the bash documentation http://mywiki.wooledge.org/DotFiles :
"Now, since bash is being invoked as a login shell (with name "-bash", a special ancient hack), it reads /etc/profile first. Then it looks in your home directory for .bash_profile, and if it finds it, it reads that. If it doesn't find .bash_profile, it looks for .bash_login, and if it doesn't find that, it looks for .profile (the standard Bourne/Korn shell configuration file)"

I DO have a ~/.bash_profile, which is quite common actually. So ~/.profile never gets read and I don't have my environment variables defined when using a login shell.

Am I missing something?
Shouldn't it be at least defined in the ~/.rc file?

Thanks
Labels (1)
0 Kudos
(5) Replies
rpadmava
Level 3

benjamin.jaton wrote:
Hi,

From the doc:
"Set environment variables on the end user’s system. Compatible with Windows and Unix only. Unix Bash, sh, ksh, zsh, csh, and tcsh shells are supported."

Under Ubuntu and RedHat with Bash, the task defines my environment variable into ~/.profile.

From the bash documentation http://mywiki.wooledge.org/DotFiles :
"Now, since bash is being invoked as a login shell (with name "-bash", a special ancient hack), it reads /etc/profile first. Then it looks in your home directory for .bash_profile, and if it finds it, it reads that. If it doesn't find .bash_profile, it looks for .bash_login, and if it doesn't find that, it looks for .profile (the standard Bourne/Korn shell configuration file)"

I DO have a ~/.bash_profile, which is quite common actually. So ~/.profile never gets read and I don't have my environment variables defined when using a login shell.

Am I missing something?
Shouldn't it be at least defined in the ~/.rc file?

Thanks


Hi Benjamin,
You got any solution for this issue?

Regards,
Padma.R
0 Kudos
Masudkhan
Level 5

Have you tried Set Environment Variable for All users?
0 Kudos
pv7721
Level 20

I think that I used a "hack" by sourcing the .profile file in the .bash_profile.
0 Kudos
benjamin_jaton
Level 3

InstallAnyWhere 2012 Ent. has a fix for that.
It's too bad their didn't backport it in earlier versions.

@Masudkhan: I don't think that would work, you would probably need superuser privileges to achieve that and change the /etc/profile.

#pv7721: how do you change the .bash_profile? custom script? This could have other side effects.
0 Kudos
pv7721
Level 20

No, no custom code, just as the last line add a source .profile line
0 Kudos