I saw a command line prompt from my colleagues on my system (Linux), which had a color and smiling face.
I think it's cool, and I also copied it,
Display Policy: current user, time, current directory,
If a common user displays a smiling face, the user can operate it at will and follow the $ prompt.
If a superuser shows a suface:-| it means to be cautious with the operation and follow the # prompt.
Create a ps1.sh file in/etc/profile. d/and add the following shellCodeBash Language: The highlighted code is provided by the germination network.
Ps1_base="[\ [\ E [33m \] \ U @ \ [\ e [34m \] \ t \ [\ e [37m \]> \ W
" Ps1_user = "$ {Ps1_base} :-) \ [\ e [0m \] \ $"
Ps1_root = "$ {Ps1_base}:-| \ [\ e [0m \] \ $"
If [ ` Whoami` = "Root" ]
Then Export PS1 =
$ { Ps1_root
} ;
Else Export PS1 =
$ { Ps1_user
} ;
Fi ; If you have some shell syntax, I will not explain it.
The PS1 environment variable determines how to display the command line. \ E ** is used to set the color. \ $ Is used to display $ at different times ,#
NOTE: If \ is not present, it will be under root and will not be displayed #