On 2021-04-26, [email protected] <[email protected]> wrote:
> I have some custom additions to my $PATH. They're defined in ~/.profile 
> and they are correctly loaded when I log in from a text console.
>
> When I log in to X (cwm) and open a terminal window, $PATH does not 
> contain the entries.
>
> I tried `chmod +x` on my .profile but that didn't help.
>
> Both the text console and the X terminal window are using ksh.
>
> When I call `/bin/ksh -l` then the resulting shell contains the correct 
> additions to $PATH.
>
> It looks like the custom $PATH is not being passed from the login shell 
> on downwards, since ~/.profile is only read by a login shell.

Seems that your terminal in X is not configured to run a login shell.
By default that is done for xterm via .Xdefaults in a new user's profile
directory (copied from /etc/skel) but if you use a different terminal
or have modified these files, that won't be used.

> ~/.kshrc is (according to ksh(1)) read by every spawning shell, but I 
> don't see any documentation or examples on the Internet where someone 
> defined their $PATH in ~/.kshrc ...

That is only if ENV is set.

> What's the correct way to set $PATH and have it stick no matter where 
> and when the shell is spawned?

If it's just PATH or some other environment variable, setting it for
the relevant class in /etc/login.conf is one option. But probably
simpler to configure your X terminal to run login shells.


Reply via email to