[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bash isn't reading ~/.profile file when login from GNOME



Hi there,

From few days, I'm trying find answer of a question "which program does
read ~/.profile if I login from graphical user interface (for ex: GNOME)?".

I'm trying to get colored man page output by sourcing ~/.less_termcap"
[1] file from ~/.profile [2] but, LESS_TERMCAP_xx unset and empty

$ hd <<< "$LESS_TERMCAP_mb"
00000000  0a                                                |.|
00000001

To fix this problem I've to source ~/.profile from gnome-terminal
(output after running `source ~/.profile` in gnome-terminal)

$ hd <<< "$LESS_TERMCAP_mb"
00000000  1b 5b 31 3b 33 32 6d 0a                           |.[1;32m.|
00000008

This problem only happens when I login from graphical interface whereas,
login from console works perfectly fine means value of LESS_TERMCAP_xx
set correctly and gets colored man page output.

I've asked this question on some IRC channels (#debian, ##linux, #bash)
but, didn't get the right answer. Some says
    * "Login from graphical interface doesn't trigger login shell" then
who reads ~/.profile file?
    * "Bash isn't started as login shell" but bash is my default login
shell which I verified by login from console and check default login
shell entry in /etc/passwd file.
    * "Graphical Desktop Managers don't read ~/.profile file" with which
I agreed. But, I've a counter question if no one reads ~/.profile file,
how does value of PATH variable set correctly which I've set in
~/.profile file.

$ echo "$PATH"
/home/finn/.local/bin:/home/finn/.local/bin:/home/finn/.local/lib/npm/bin:/home/finn/scripts:/home/finn/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games


From this, I've concluded that some program must reads ~/.profile when I
login from graphical interface but, not by bash may be some other shell
(for ex: sh, ksh etc) despite of being bash as default login shell.
Please correct if I'm wrong.

Any help would be greatly appreciated.

## Additional info:

Debian Stretch (v9.9) with GNOME interface.

$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)

## References:

[1]: https://salsa.debian.org/snippets/316 (link to ~/.less_termcap file)
[2]: https://salsa.debian.org/snippets/314 (link to ~/.profile file)

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: