1

I am trying to display double > "»". I belive it is xBB in char set. How can I do it?

Thanks

kos
  • 35,535
  • 13
  • 101
  • 151
linux-lover
  • 21
  • 1
  • 2

1 Answers1

2

The » character is the Unicode character U+00BB;

You may print it using its Unicode code point (in bash 4.2+) or its UTF-8 hexadecimal representation using echo:

user@debian ~ % echo -e '\u00BB' 
»
user@debian ~ % echo -e '\xC2\xBB'
»

Or using printf:

user@debian ~ % printf '%b\n' '\u00BB'
»
user@debian ~ % printf '%b\n' '\xC2\xBB'
»
kos
  • 35,535
  • 13
  • 101
  • 151
  • Thanks for answer. It works. Question: what the \u00 means and what different from \x00\xC2? Why it works on other term type by just using \xBB? – linux-lover Sep 04 '15 at 02:27
  • @linux-lover Actually my answer was rather unprecise, for various reasons; see the update. The `\uNNNN` sequence is directly interpreted as an Unicode code point (this works only in `bash` 4.2+), while *I guess* that the `\xC2\xBB` sequence is interpreted based on the shell's current encoding. Where did you type `\xBB` to get `»`?. Anyway I'd like to tell more about the second option, but in total honesty I just know that it works. Gonna do some research tomorrow tough, since I'm interested as well, and I'll update this answer as well. – kos Sep 04 '15 at 03:33
  • Sorry, did not response immediately. Your suggestions work on both method. I use \xBB to get >> on command prompt for many years from old version putty (NOT 2015-09-02.1e0e962) to linux (Oracle, Red hat and SuSe). Now, I have to use your suggestion. – linux-lover Sep 09 '15 at 15:31