linux and robert

2011年12月16日 星期五

bash, convert integer to ascii char

# convert integer to ascii char
chr() {
printf \\$(printf '%03o' $1)
}

for example,
echo `chr 0x61` ---> a

Ref:
http://ubuntuforums.org/showthread.php?t=735140
張貼者: no 於 下午4:05
以電子郵件傳送這篇文章BlogThis!分享至 X分享至 Facebook分享到 Pinterest

沒有留言:

張貼留言

較新的文章 較舊的文章 首頁
訂閱: 張貼留言 (Atom)

網誌存檔

  • ►  2016 (1)
    • ►  6月 (1)
  • ►  2014 (1)
    • ►  3月 (1)
  • ►  2012 (5)
    • ►  12月 (2)
    • ►  3月 (1)
    • ►  2月 (2)
  • ▼  2011 (9)
    • ▼  12月 (1)
      • bash, convert integer to ascii char
    • ►  10月 (1)
    • ►  6月 (2)
    • ►  5月 (1)
    • ►  3月 (1)
    • ►  2月 (2)
    • ►  1月 (1)
  • ►  2010 (9)
    • ►  12月 (2)
    • ►  5月 (1)
    • ►  4月 (3)
    • ►  1月 (3)
  • ►  2009 (16)
    • ►  12月 (3)
    • ►  11月 (3)
    • ►  10月 (4)
    • ►  9月 (5)
    • ►  8月 (1)

關於我自己

no
檢視我的完整簡介
簡單主題. 技術提供:Blogger.