I just ran across a screenshot of someone's terminal:
Is there a list of all of the characters which can be used in a Bash prompt, or can someone get me the character for the star and the right arrow?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
There are a lot of characters in Unicode, so here are a few tips to help you search through the Unicode charts:
ıare latin letters with modifiers;
∉is a mathematical symbol, and so on.
In a bash script, up to bash 4.1, you can write a byte by its code point, but not a character. If you want to avoid non-ASCII characters to make your
.bashrc resilient to file encoding changes, you'll need to enter the bytes corresponding to these characters in the UTF-8 encoding. You can see the hexidecimal values by running
echo ∴ → ☿ ★ | hexdump -C in a UTF-8 terminal, e.g.
∴ is encoded by
\xe2\x88\xb4 in UTF-8.
if [[ $LC_CTYPE =~ '\.[Uu][Tt][Ff]-?8' ]]; then PS1=$'\\[\e[31m\\]\xe2\x88\xb4\\[\e[0m\\]\n\xe2\x86\x92 \xe2\x98\xbf \\~ \\[\e[31m\\]\xe2\x98\x85 $? \\[\e[0m\\]' fi
Since bash 4.2, you can use
\u followed by 4 hexadecimal digits in a
PS1=$'\\[\e[31m\\]\u2234\\[\e[0m\\]\n\u2192 \u263f \\~ \\[\e[31m\\]\u2605 $? \\[\e[0m\\]'