> PATH is defined on several levels. "Child" processes inherit PATH from > their "parents".
PATH is an environment variable. Each process has its own environment
which is copied into its children.
> I suppose:
> ~/.bash* belongs to a child process of the one defined in
> /etc/profile.d.
>
> the /etc/profile.d belongs to a child of /etc/environment .
>
> Is this correct?
Shell processes run commands from various initialization files, bash
uses /etc/profile, ~/.bash_profile, ~/.bashrc and others depending on
how it's run (the manual explains this in detail). /etc/environment has
other uses.
Most processes that a user runs are started (directly or indirectly)
From a shell.
> I like the solution with the extra fil in /etc/profile.d, but I have
> some questions first.
> 1. on what level is PATH defined here?
These files are sourced from /etc/profile which is sourced from login
shells when they start ("source" is a shell command for running commands
From a file in the same process; shell scripts are typically run in
separate processes).
> 2. can the file have any name?
It must end with ".sh".
> 3. what should be in the file? Just the same as I have added to by
> ~/.bashrc? (See above)
E.g. this line:
export PATH=$PATH:/usr/local/texlive/2012/bin/i386-linux
(or change PATH and export it on a separate line; export is needed since
otherwise it will be only a shell variable that isn't available to other
processes.)
pgpN3tyKcU3Z3.pgp
Description: PGP signature
