I have been learning bash, and while doing so I played around with the .bash_profile
file to be able to put greeting messages etc. Later I just removed these changes. But after doing that my default configuration of prompt got lost: originally, the prompt was all in bold, and \w
part was blue so that when I was in a deeply nested directory the prompt would not seem so entangled. I think that was the default for Ubuntu (correct me if i'm wrong), however like I said it got lost and my prompt was non-bold and monochromatic resulting in a mess when I'm in long named directories.
So, last night I tried customizing my prompt in the fashion I mentioned above. It worked well after I added the code to .bash_profile
Code was like this:
export PS1="\[$(tput bold)\]\u@\h:\[$(tput sgr 0)\]\e[1;34m\w$ \e[m"
However if I try to run another bash shell in the current one, the prompt becomes unformatted:
Is that normal? Isn't the whole point of exporting a variable to make it accessible from all the child processes forked from that shell? Why it doesn't that apply to this situation?
export
call ? At the end of the~/.profile
? – Sergiy Kolodyazhnyy Aug 21 '16 at 11:11~/.bash_profile
, i moved that to~/.bashrc
and deleted the previous file since there were only the prompt customization andls
grep
dir
aliases for colored output in the file. Based on your answer i got that if there is not~/.bash_profile
file at all, the code in the~/.bashrc
should be sourced, for both login and non-login shells; therefore i did as you suggested and voila! thank you so much! – etka Aug 22 '16 at 10:11