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\]<HERP(._.)DERP>\[\e[0;0m\]";
but can you set a tiny little image in there as well? For instance, if I wanted to add a little American flag icon, or something before "HERP(._.)DERP", could I do this?
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
The closer you'll get are white and black flags:
The above are Unicode characters. You could also look for a font with flags - I don't know of any.
there is no way to add an icon (bitmap or vector graphic) to the bash prompt.
Sorry, no. Terminals don't do graphics.
For a full description of what you can do, see the PROMPTING section of the bash(1) man page:
The
\e
,\[
and\]
escape sequences deserve special attention. With these you can insert ANSI escape codes to command the terminal to change foreground color, background color, move the cursor, erase parts of the screen, and do other fancy tricks.That is, for instance, how your prompt changes color.
\[\e[0;31m\]
sets the foreground color to red, and\[\e[0;0m\]
resets it back to the default.Actually, Yes, you can.
In recent versions of Bash, at least 4 (i could do it in 4.2 and 4.3), you can render emoji with the hex.
Use the
echo -e
flag.paste an emoji you looked up in and do a hexdump to see what it's made of: