Where to set environment variables
Doug M-C
lists at dshop.morrisoncleary.info
Wed Oct 20 15:12:26 UTC 2004
Shouldn't you export PATH before the 'if' statement in
/etc/profile. And then make sure that any PATH statements in
.bashrc and .bash_profile anywhere else, including in /etc, begin
with '$PATH:'?
That way you are setting the default or system wide variable in
the proper place '/etc/profile', and any additional PATH
information then gets added to the default!
Doug
On Wed, 20 Oct 2004 15:41:20 +0100
"Richard M. Barry" <R.Barry at sstl.co.uk> wrote:
> I'm guessing that:
> The code in the if-statement (in your /etc/ executes the
> /etc/bash.bashrc script, and $PATH gets set in there (ie reset
> from what you just set it). Try moving the "PATH=" statement to
> after the if (just before the export PATH statement), and add
> ":$PATH" to the end of it (or else you'll again reset $PATH
> after /etc/bash.bashrc executed).
>
> I hope that made sense.
>
> > Can anyone tell me definitively where to put environment
> > settings please?
>
> >
>
> > I have installed the j2sdk from Sun, but need to alter my PATH
> > to point
>
> > to it.
>
> /etc/profile typically sets PATH system-wide (to be overriden in
>
> ~/.bash_profile), so please use that. You should already have
> the
>
> variable set there (and exported at the end of file) so just add
> to it
>
> your java path.
>
>
>
>
> Got the same problem here. Following, you can see my
> /etc/profile:
>
>
> root at basti:/home/bdoetsch # more /etc/profile
>
> # /etc/profile: system-wide .profile file for the Bourne shell
> (sh(1))
>
> # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
>
>
>
> JAVA_HOME="/opt/jdk1.5.0"
>
>
>
> PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/s
> bin:/usr/bin/X11:/usr/games:$JAVA_HOME:$JAVA_HOME/bin"
>
>
>
> if [ "$PS1" ]; then
>
> if [ "$BASH" ]; then
>
> PS1='\u@\h:\w\$ '
>
> if [ -f /etc/bash.bashrc ]; then
>
> . /etc/bash.bashrc
>
> fi
>
> else
>
> if [ "`id -u`" -eq 0 ]; then
>
> PS1='# '
>
> else
>
> PS1='$ '
>
> fi
>
> fi
>
> fi
>
>
>
> export JAVA_HOME
>
> export PATH
--
Doug M-C
Email: <lists AT dshop DOT morrison-cleary DOT info> Key ID: D5CC3E8F
+++++++++++++++++++++++++++
Email, signature, & copyright policies:
<http://hildormen.net/policies.html>
More information about the ubuntu-users
mailing list