Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Homebrew has a neat trick of printing out little icons next to its output. Like this:

brew icons in terminal output

If I copy paste the icon it on its own and hit enter I get the result:

-bash: $'?\237\215?': command not found

And if I try it with echo or printf I just get ????. Same if I escape all the quotes and $s etc.

editron:~ stib$ echo $'?\237\215?'
????

So how do they do that? What do the magic characters $'?\237\215?' mean?

share|improve this question

2 Answers 2

up vote 43 down vote accepted

Homebrew is open source, so you can read its code to find out how it shows the icon. The line they're using is in the file formula_installer.rb:

print "🍺  " if MacOS.version >= :lion

The first character in the print command is a "🍺", or unicode #1f37a 'BEER MUG'.

So it's not an icon but an funny unicode beer mug :)

share|improve this answer
9  
Awesome. So in the shell I can just do echo -e "\xF0\x9f\x8d\xba" –  stib Jan 18 '13 at 13:28
3  
Also, try looking it up in the OS X dictionary (right click > look up) ;) –  ihatetoregister Feb 13 '13 at 1:13
3  
Or with octal: echo $'\360\237\215\272' –  Chad Skeeters Jul 3 '13 at 21:46

BTW, try another variants in terminal:

echo $'\360\237\215\270'
echo $'\360\237\215\271'
echo $'\360\237\215\273'
echo $'\360\237\215\274'
share|improve this answer
2  
For those who do not have a font containing these symbols: These are symbols/pictures of various drinks. See codepoints.net/miscellaneous_symbols_and_pictographs –  pabouk Nov 4 '13 at 5:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.