They say that by adding "export SOME_BOGUS_VAR=some_value" in
/etc/profile, the bogus var should be set when any graphical terminal
(such as xterm, konsole, gnome-terminal, etc.) is opened. The reason
for that would be that when a X session is opened, a pseudo-terminal in
/dev/pts/n is opened as a login shell.
However, this doesn't make much sense to me, and it doesn't work on my
Debian box. If I want to achieve something like that, I must add the
bogus variable to /etc/bash.bashrc.
Perhaps someone here could help come to a conclusion as to whether one
should expect /etc/profile to be sourced on graphical terminals.
--
Bruno de Oliveira Schneider
Environment variables set in /etc/profile will only be visible to
children of the shell that sourced it. If the script that starts X
(or the shell that is running that script) sources it, then the
variables will be visible to shells started under X.
> However, this doesn't make much sense to me, and it doesn't work on my
> Debian box. If I want to achieve something like that, I must add the
> bogus variable to /etc/bash.bashrc.
That file is not sourced by bash, but by some other script.
> Perhaps someone here could help come to a conclusion as to whether one
> should expect /etc/profile to be sourced on graphical terminals.
If the terminal is opened with bash as a login shell, then it will
be sourced; otherwise it will not.
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
On 2005-04-17, Chris F.A. Johnson wrote:
> That file is not sourced by bash, but by some other script.
That is strange. At my Debian machine, "man bash" says (in Invocation
section):
"When an interactive shell that is not a login shell is
started, bash reads and executes commands from /etc/bash.bashrc and
~/.bashrc, if these files exist."
Are different bash versions with different initialization procedures?
Here is what my bash says about its version:
$ bash --version
GNU bash, version 3.1.0(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
Debian distributes a bastardized version of bash. So, for that
matter, do other Linux distros, but Debian seems to be the worst.
I always compile my own bash to be certain of getting standard
behaviour.
> Are different bash versions with different initialization procedures?
> Here is what my bash says about its version:
>
> $ bash --version
> GNU bash, version 3.1.0(1)-release (i486-pc-linux-gnu)
> Copyright (C) 2005 Free Software Foundation, Inc.
--