FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 05-16-2008, 02:22 PM
TomasN
 
Default /etc/environment, variables aren't expanded

Hi. Why the environment variables in /etc/environment aren't expaned?

JAVA_HOME="/opt/jdk1.6.0_06"
JDK_HOME="$JAVA_HOME"
JRE_HOME="$JDK_HOME/jre"
PATH="$JDK_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

... in /etc/profile each variable in quotes is expanded.


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 05-17-2008, 02:47 AM
Cameron Hutchison
 
Default /etc/environment, variables aren't expanded

TomasN <nechtom@gmail.com> writes:

>Hi. Why the environment variables in /etc/environment aren't expaned?

Because /etc/environment is not a shell script. It is the shell that
does expansion of environment variables. The PAM module pam_env is what
reads /etc/environment - and it treats it as a simple list of KEY=VAL
pairs and sets up the environment accordingly. It has no language for
doing variable expansion.

>JAVA_HOME="/opt/jdk1.6.0_06"
>JDK_HOME="$JAVA_HOME"
>JRE_HOME="$JDK_HOME/jre"
>PATH="$JDK_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

>... in /etc/profile each variable in quotes is expanded.

/etc/profile is a shell script, and as such it has access to the full
facilities of the shell.

I personally think /etc/environment is rather useless for the reasons
you've just found. It is too simplistic to just have KEY=VAL lines is a
lot of cases.

Just use /etc/profile instead of /etc/environment. That's what I do.

.

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 05-17-2008, 09:20 AM
TomasN
 
Default /etc/environment, variables aren't expanded

Dne Saturday 17 May 2008 04:47:26 Cameron Hutchison napsal(a):

> I personally think /etc/environment is rather useless for the reasons
> you've just found. It is too simplistic to just have KEY=VAL lines is a
> lot of cases.

Me too.
I was just wondering why so many people recommend to put variables there.
Thank you for explanation.



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 05-17-2008, 11:25 AM
Florian Diesch
 
Default /etc/environment, variables aren't expanded

TomasN <nechtom@gmail.com> wrote:

> Dne Saturday 17 May 2008 04:47:26 Cameron Hutchison napsal(a):
>
>> I personally think /etc/environment is rather useless for the reasons
>> you've just found. It is too simplistic to just have KEY=VAL lines is a
>> lot of cases.
>
> Me too.
> I was just wondering why so many people recommend to put variables there.

* /etc/environment works with every shell, not just with sh-like shell
like /etc/profile does

* /etc/profile only gets read by login shells. For graphical logins
you don't get a login shell so it's up to the X session
configuration to read /etc/profile. It seems that gdm and kdm are
doing this with most Linux distributions, but others may not.



Florian
--
<http://www.florian-diesch.de/>
-----------------------------------------------------------------------
** Hi! I'm a signature virus! Copy me into your signature, please! **
-----------------------------------------------------------------------

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 05-18-2008, 04:56 PM
Thilo Six
 
Default /etc/environment, variables aren't expanded

TomasN wrote the following on 16.05.2008 16:22

> Hi. Why the environment variables in /etc/environment aren't expaned?
>
> JAVA_HOME="/opt/jdk1.6.0_06"
> JDK_HOME="$JAVA_HOME"
> JRE_HOME="$JDK_HOME/jre"
> PATH="$JDK_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
>
> ... in /etc/profile each variable in quotes is expanded.

since 'xorg (1:7.3+8ubuntu2) hardy' there is also:

$ zless -p "Add support for" /usr/share/doc/x11-common/changelog.gz

which might does what you are looking for.

--
bye Thilo

key: 0x4A411E09


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 09:55 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org