I am using gdm3 as my login manager. Upon login, all the PATH modifications in my .profile are set and exported correctly. For example, lines like these below work fine:

if [ -d "$HOME/bin" ] ; then

if [ -d "$HOME/.local/bin" ] ; then

However, line below doesn't work as expected:

# Use colors for less, man, etc.
[[ -f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP

The file ~/.LESS_TERMCAP just contains a bunch of export statements. Interestingly, if I start up my terminal and type . .profile, then ~/.LESS_TERMCAP does get sourced. Why isn't that happening at startup? I come across many dot files that include such 'and list' constructs, so I am a bit confused. Thank you for all the help.


As noted in the comments by @fra-san, part of the issue is resolved by noting that the display manager runs dash instead of bash, and replacing [[ with appropriate test constructs. However, I am still perplexed by the following situation: the file ~/.LESS_TERMCAP is not sourced, even though PROFILE_VARIABLE is set. ~/.LESS_TERMCAP contains the following:

export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'

However, running . ~/.profile does bring color to man pages. I am on Debian Sid, running gdm3 and i3. Please let me know any additional info I can provide.

  • [[ is Bash-specific, can you replace it with the regular if [ like in lines above? – Arkadiusz Drabczyk Feb 23 at 18:55
  • I changed [[ -f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP to [ -f ~/.LESS_TERMCAP ] && . ~/.LESS_TERMCAP, but now upon reboot instead of color, I see weird control characters in man pages. – firedrillsergeant Feb 23 at 19:05
  • I just changed [ -f ~/.LESS_TERMCAP ] && . ~/.LESS_TERMCAP to [ -f ~/.LESS_TERMCAP ] && source ~/.LESS_TERMCAP and rebooted again, and this time I don't see the weird control characters but there is no color in the man pages either. However, sourcing the .profile manually brings color to the man pages. – firedrillsergeant Feb 23 at 19:06
  • 2
    The issue in your question seems to be solved by noting that your display manager uses a POSIX shell (i.e. no support for [[) to source your .profile. The issue in your comments seems to be unrelated to the first one and you should probably ask a new question (or reword this one if you are not looking for an answer to it anymore). It may be useful to know which operating system (and version) you are using and, possibly, see the relevant parts of the sourced files (though I wouldn't know for sure). – fra-san Feb 23 at 20:13
  • Do you also have a ~/.bash_profile file? – Kusalananda Feb 23 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.