RHEL6 customizing prompt do not work

Hi,

I'm trying to customize the ksh prompt for users on a RHEL 6.6 system for having user@host pwd : $ and user@host pwd # in red color for root.

I think it's possible but i do not even succeded for a non root user :

I added in my ~/.kshrc :

PS1="Hello : "

and it works

but when i used

PS1="\u@\h $"

the prompt is :

u@h $

Thank You for your help

Hello Fundix,

Could you please try following and let me know if this helps.

PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '

Thanks,
R. Singh

1 Like

/u and /h do work in bash. I don't think they do in ksh, which has different methods.

1 Like

Thank You :slight_smile:

You might test something like this in .kshrc:

PS1=$(printf "%s%s%s" '\[\033[1;31m\]' "$(whoami)@$(hostname): $(basename $PWD) # " '\[\033[0m\]')
1 Like