Matthias Benkmann matthias at
Sun Dec 2 15:14:05 PST 2001

On 2 Dec 2001, at 14:43, Stefano wrote:

> On Sunday 02 December 2001 13:15, you wrote:
> >
> > It certainly does work for me. You should put an "echo path"  statement
> > into every bash_profile and bashrc you have on the system (where path is
> > the path to the file) to see if the files you think are being sourced are
> > in fact being sourced. And you should make sure that none of the scripts
> > you source starts a new shell because aliases are not inherited. You
> > could include the command
> >
> > ( exec sh -c 'echo $PPID' )
> >
> > exactly as written here (i.e. including the parentheses and quotes)
> > in your scripts. This will output the PID of the shell that sources the
> > file. Later when your shell has finished loading you can use ps and check
> > if the shell you're working with is really the one that sourced the
> > aliases.
> Mmmmmm, if i understood right, you said that my X shell is not the one that
> inherits my bashrc and bash_profile scripts. But every change i make in
> that scripts are in my shell, for example when i add a new executable
> directory to run a new program, changing the $PATH in there. 

Environment variables (if they are exported) are passed down to shells, 
aliases are not. So if you have the following in you .bashrc

export PATH=foo
alias xyz=bar
exec /bin/bash

then changes to PATH will take effect but the alias will not because the 
shell started with  "exec /bin/bash" does not inherit the aliases.

>Well, maybe
> i'm confusing different things, could you be so kind to give me an example
> of what you mean with "echo path"? 

Just put the following at the beginning of ~/.bashrc

echo -n "Hallo, now running ~/.bashrc in shell with PID" 
( exec sh -c 'echo $PPID' )

At the beginning of .bash_profile you put

echo -n "Hallo, now running ~/.bash_profile in shell with PID" 
( exec sh -c 'echo $PPID' )

And there are other files that bash may or may not source such as 
/etc/profile or whatever (look in the bash manpage to find out what it 
sources and what it doesn't). Put messages like the above into them, too.

Now when you open a new xterm you should see messages like

Hallo, now running ~/.bashrc in shell with PID  3744

Then you can use ps to find out if the shell your typing at is the one 
that sourced the .bashrc. If so, it should have the aliases.


Support bacteria - they're the only culture some people have.

Unsubscribe: send email to listar at
and put 'unsubscribe blfs-support' in the subject header of the message

More information about the blfs-support mailing list