The value of PS1 here is [u]$. The reason why it is finally displayed as [root]# is entirely because bash has done another explanation operation!
Because bash needs to explain how to display it after seeing [u]$. According to bash rules, u is to display the login account name. $You can search it yourself.
The value of
PS1
here is[u]$
. The reason why it is finally displayed as[root]#
is entirely becausebash
has done another explanation operation!Because
bash
needs to explain how to display it after seeing[u]$
. According to bash rules,u
is to display the login account name.$
You can search it yourself.Single quotes are not escaped, double quotes are escaped, for example, a='123', then
echo ‘a$a’
The output is a$a
echo “a$a”
The output is a123
Has your file been resolved? I have the same problem and I couldn’t find the answer online