Skip to content

Instantly share code, notes, and snippets.

@ChinaXing
Created December 18, 2012 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChinaXing/4325495 to your computer and use it in GitHub Desktop.
Save ChinaXing/4325495 to your computer and use it in GitHub Desktop.
bash char and char-code convert method
print -v variable "%o" \'A # variable: 101 in octal
echo $'\101' # produce: A, 101 is octal code of Character 'A'
echo $'\x41' # produce: A, 41 is hex code of Character 'A'
echo $'\u4e2d' # produce: 中, 4e2d is hex code order of ‘中’ in unicode character table.
print "%x" \'中 # produce: 4e2d, ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment