$'\nnn' - Linux

By Hazel
at 2008-09-03T20:53
at 2008-09-03T20:53
Table of Contents
※ 引述《godfield (咖啡貓)》之銘言:
: ※ 引述《antontw (習慣)》之銘言:
: : cat test.txt #範例文字檔
: : \346\226\260\351\200\262
: : anton@gama:~/test$ cat test.sh
: : #!/usr/bin/env bash
: : T=`cat test.txt`
: : echo "echo "\$\'$T\'|bash
: : 這樣就可以把 test.txt 裡面的 \346\226\260\351\200\262 轉回來。
: : 沒有很好啦,應該會有很多例外...
: 一行文:
: eval echo "$'$(< test.txt)'"
我也回一個自己的發現
在我的 ubuntu 中有兩種版本的 echo
一個是 bash 內帶的 echo 另一個 /bin/echo(包含在 coreutils 套件中)
不過預設會使用 bash 自己的 echo,還要打入完整 path 才行
/bin/echo -e `cat file`
就得到結果了
--
my blog: http://kenshinnn.blogspot.com
operation system : Ubuntu GNU/linux
window manager : Gnome
--
: ※ 引述《antontw (習慣)》之銘言:
: : cat test.txt #範例文字檔
: : \346\226\260\351\200\262
: : anton@gama:~/test$ cat test.sh
: : #!/usr/bin/env bash
: : T=`cat test.txt`
: : echo "echo "\$\'$T\'|bash
: : 這樣就可以把 test.txt 裡面的 \346\226\260\351\200\262 轉回來。
: : 沒有很好啦,應該會有很多例外...
: 一行文:
: eval echo "$'$(< test.txt)'"
我也回一個自己的發現
在我的 ubuntu 中有兩種版本的 echo
一個是 bash 內帶的 echo 另一個 /bin/echo(包含在 coreutils 套件中)
不過預設會使用 bash 自己的 echo,還要打入完整 path 才行
/bin/echo -e `cat file`
就得到結果了
--
my blog: http://kenshinnn.blogspot.com
operation system : Ubuntu GNU/linux
window manager : Gnome
--
Tags:
Linux
All Comments
Related Posts
關於atd 對於一般user

By Zora
at 2008-09-03T15:29
at 2008-09-03T15:29
有比較推薦的硬碟分割程式嗎?

By Andrew
at 2008-09-03T13:15
at 2008-09-03T13:15
krfb分享出來的桌面不能被控制

By Elvira
at 2008-09-03T12:35
at 2008-09-03T12:35
fsck 這功能

By Irma
at 2008-09-03T11:31
at 2008-09-03T11:31
怎麼讓自己寫的code進入kernel中呢?

By Isla
at 2008-09-03T11:26
at 2008-09-03T11:26