How to add an icon to the bash prompt

前端 未结 6 845
予麋鹿
予麋鹿 2021-02-04 16:09

I know you can edit the bash prompt permanently by editing the PS1 variable in your ~/.bashrc file, mine looks like this:

PS1=\"\\[\\e[0;31m\\]

        
6条回答
  •  终归单人心
    2021-02-04 16:46

    Nowadays, you can add emoji if you have an emoji-aware font. I guess this wasn't a easily viable option when the question was originally posted

    I wrote this blog post about it a couple of years ago.

    I don't know about American flags, but export PS1="\360\237\232\251 > " gets a flag in your prompt.

    I also wrote a shell tool to make printing the escapes for echo or shell prompt a little easier. It's called emo

提交回复
热议问题