开发者

How can I display a tux character in a shell script?

I realize this is very much of a long shot, but...

In shell scripts on Macs I can display an Apple character. Is there any way to display a Tux character (or anything else associated with Linux) on Linux systems?

The simplest solution would be if there's something in the Unicode set that symbolizes Linux, whether a Tux or something else. I haven't been able to find such a character through Googling, but maybe someone knows of one.

Another solution would be if there's some way (that 开发者_JAVA百科I'm completely unaware of) to define characters on Linux, and display them in a terminal. (Seems impossible, but who knows? We used to do this on Commodore systems all the time!)

(I'm skipping the full backstory as to why this is useful, but the short version is that I'm looking for a way of displaying in as little space as possible in my PROMPT what kind of system I'm using, since I log into perhaps almost a hundred different servers, on different operating systems, and there are times a visual reminder would be very useful.)

If there does turn out to be a Unicode solution, I'll ask separate questions for Solaris and Windows. But this is a long shot, so no point in asking those right now.


There's a penguin character in UNICODE. No font on my machine seems to be able to render it, but I'm using Linux, not MacOS, so your mileage may vary.


The character that displays an Apple logo on Apple computers, ‹›, is code point 0xF0 in MacRoman. Despite appearances, MacRoman is not an Italian hamburger but rather an 8-bit legacy character set carried forward from Apple's pre-Unix days. The mapping tables for MacRoman to Unicode place MacRoman 0xF0 at Unicode U+F8FF, which is in the Private Use area. It has the Unicode regex properties \p{Co} (aka \p{Other}) and \p{InPrivateUse} (aka \p{Private_Use}). Its script type is unknown, corresponding to the Unicode property \p{Script=Unknown}, also known as \p{Unknown}, \p{Script=Zzzz} or \p{Zzzz}. Its only other general categories are \p{Graph} and \p{Print}.

Besides its own logo at the very end of the private use area, Apple has other private use characters: ‹› at U+F804 for an "eject" glyph, ‹› at U+F802 for a "pencil" glyph, and ‹› at U+F803 for a glyph of a pointer into a sunburst. These have no mapping into MacRoman.

There is nothing stopping a Linux system from grabbing some code point from the Private Use Area (which lies in plane 0 from U+E000 – U+F8FF), or from either of Supplementary Private Use Area A (plane 15: U+F0000 – U+FFFFD, or B (plane 16: U+100000 – U+10FFFD), and doing with it whatever it pleased.

These wouldn't be meaningful for interchange, but they could do it. It might even be fun to watch all the miscoded Java programs break on characters from up in the astral planes that are too big to fit into Java's (oxy)moronic char data type. ☺

In the very recently release Unicode 6.0, the controversial Emoji block does include code point U+1F427, PENGUIN. Scant few fonts yet support Unicode 6.0, but you can see what it looks like here on page 1256 of Unicode 6.0.

Being an astral character, it would also cause conniptions in all those programming languages and environments whose broken character abstractions misrepresent characters as 16-bit entities instead of abstract characters.

(Hm, do we have a definitive list of those, those that expose the user to physical encodings instead of presenting abstract characters? What else besides Java?)

So it's probably not a good idea except as an agent provocateur. Plus it doesn't really look all that much like Tux, anyway.

Personally, I really don't see the need to encode corporate logos as single code points. That's why we have GIFs and the like.


While Googling I came across the following symbol, by accident. It's Tux and it seems to be pure text (unicode?). I'm not sure if it is something Linux or Ubuntu specific. This is the symbol

According to Vim the character is: <> 57344, Hex e000, Octal 160000


U+E000, the first character of the Private Use Area, is a Tux symbol in the Linux Libertine and Linux Biolinum fonts. These fonts are included in the fonts-linuxlibertine package in Debian and Ubuntu.

This won't help the OP's use case as these are not monospace fonts, but I'm posting this in case someone else needs this character.


LUWM - Linux, Unix, Windows, Macs

no need to invent funny symbols

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜