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?
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:
plasmarob ~ $ echo -n "🇺🇸"| hexdump
0000000 f0 9f 87 ba f0 9f 87 b8
0000008
And then take that top line and escape each hex pair with \x :
plasmarob ~ $ echo -e 'See? \xf0\x9f\x87\xba\xf0\x9f\x87\xb8'
See? 🇺🇸
I actually modified mine to be:
plasmarob ~ ⚡
So yes, come up with one like this and try adding it to your .bashrc
or .bash_profile
.
Edit: Something with SO or browser rendering may have changed because the flag in this post now renders as a "US" character. YMMV but i assume it will still work in the stated versions of bash.