Reputation: 20000
I use a single ~/.bashrc
file in all my machines that log in and I have the following line to display the command prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
I don't want to see the username if it is 'sudar' but want to see it otherwise. How can I change the above line to drop the username part if it is equal to 'sudar'?
Upvotes: 0
Views: 145
Reputation: 3880
if [[ $USER == sudar ]]
then
PS1="THINGS YOU WANT IN PS1 VARIABLE"
else
PS1="THINGS YOU WANT IN PS1 VARIABLE"
fi
Upvotes: 3