0
TL;DR:
PS1 is not as it's supposed to be.
PS1="\W"
shows as \w█
the block being the blinking cursor. The folder name will appear only after directory change. OS is Debian 9.9 Stretch. I'm not quite sure where I've made a mistake and kindly ask for others to take a look and give their educated opinions.
Below is my .bashrc
:
RED='\[\033[31m\]'
BOLD_RED='\[\033[1;31m\]'
YELLOW='\[\033[33m\]'
GREEN='\[\033[32m\]'
BLUE='\[\033[01;34m\]'
BOLD_BLUISH='\[\033[01;32m\]'
NORMAL='\[\033[00m\]'
USR='\u'
TIME='\t'
PWD='\w'
DIR='\W'
RIGHTS='\$'
RESET='\[$(tput sgr0)\]'
if [ $(id -u) -eq 0 ]; then
PS1="$NORMAL\t·$BOLD_RED\u@\h$NORMAL·$GREEN$DIR·$NORMAL\$ $RESET"
else
PS1="$GREEN\t$NORMAL·$BOLD_BLUISH\u@\h$NORMAL·$BLUE$DIR$NORMAL·\$ $RESET"
fi
You set
PWD
to '\w
', butPWD
is supposed to be the current working directory (the shell sets it every time you change directories). This is why you should use lower- or mixed-case variable names for your stuff; there are a lot of all-caps names with special meanings, and if you accidentally use one of them for something else, it can cause weird problems. Like this. – Gordon Davisson – 2019-06-15T20:07:15.173Thank you for pointing out the obvious! I'm surprised how I failed to notice it myself. – krg – 2019-06-17T12:02:38.983