Results 1 to 5 of 5

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

  1. #1
    Join Date
    May 2012
    Posts
    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 ~/.<user_shell>rc file?

    Thanks

  2. #2
    Join Date
    Sep 2012
    Posts
    6
    Quote Originally Posted by benjamin.jaton View Post
    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 ~/.<user_shell>rc file?

    Thanks
    Hi Benjamin,
    You got any solution for this issue?

    Regards,
    Padma.R

  3. #3
    Join Date
    Jul 2011
    Location
    Bangalore, India
    Posts
    34
    Have you tried Set Environment Variable for All users?

  4. #4
    Join Date
    Mar 2006
    Location
    Paris, France
    Posts
    2,036
    I think that I used a "hack" by sourcing the .profile file in the .bash_profile.
    Vlad

  5. #5
    Join Date
    May 2012
    Posts
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •