shell color - Linux

Selena avatar
By Selena
at 2011-07-18T13:33

Table of Contents

請教一下各位shell color顯示的問題

目前shell script中有要printf出一個有背景顏色的字串

但是這個字串的長度不一定,就是看script執行中發生幾個錯誤,最後一併輸出

但是當錯誤的東西過多時,顯示的color就會有錯誤

我想呈現的效果大概如下:

All happen errors: A-error B-error C-error D-error E-error F-error H-error G-e
rror

可是換成之後效果會面成:

All happen errors: A-error B-error C-error D-error E-error F-error H-error G-e
rror

想請問一下,我這個部份應該要怎麼改才會達到我所需要的效果,還請先進們指點

謝謝

以下是printf的部份,請參閱:

printf "\33[1;32;41m 內容 \33[0m"


--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄

--
Tags: Linux

All Comments

Lydia avatar
By Lydia
at 2011-07-22T22:44
我直覺是你的script print的部分有錯, po上來看看?
Vanessa avatar
By Vanessa
at 2011-07-23T10:54
已補上printf的實做code,請先進指點
Kelly avatar
By Kelly
at 2011-07-23T20:09
http://diablo.cs.ccu.edu.tw/~blj/color.png
Noah avatar
By Noah
at 2011-07-23T21:41
附上實際情況的貼圖
Lydia avatar
By Lydia
at 2011-07-28T03:24
where's your code?

Flash 11 Beta

Wallis avatar
By Wallis
at 2011-07-18T12:06
※ 引述《Adama (So Say We All.)》之銘言: : 超久沒更新的Flash終於出 11 Beta啦!! : support includes Linux 64-bit : http://labs.adobe.com/technologies/flashplatformruntimes/fla ...

Flash 11 Beta

Zanna avatar
By Zanna
at 2011-07-18T11:40
超久沒更新的Flash終於出 11 Beta啦!! support includes Linux 64-bit http://labs.adobe.com/technologies/flashplatformruntimes/flashplayer11/ -- Nice to meld you. ...

App Star 高手爭霸戰 開始報名!

Adele avatar
By Adele
at 2011-07-18T11:07
AppStar 高手爭霸戰 只要你有Idea!! 50萬獎金就在你手邊~ App應用程式開始普遍,儼然新一代科技革命!! 除了各類獎項,還可以上節目行銷自己的作品! ...

CentOS 6 DVD怎麼燒?

Agatha avatar
By Agatha
at 2011-07-18T07:27
下載完CentOS6之後 看到大小好像是4487mb 可是我的 DVD片 好像只能燒到4483mb 請問這要怎麼燒呀? 為什麼centos要出這種大小的發行版? - ...

如何開機自動執行2個程式?

Noah avatar
By Noah
at 2011-07-18T06:03
請問一下 現在有2個程式 路徑分別是 /usr/a 和 /usr/b 他們都是 執行之後,就持續執行下去,沒有結束的程式 我已經在 rc.local 第一行、第2行 分別寫上 2個程式路徑 可是由於他們執行之後不會停止 也就是 不會從第1行跳到第2行 執行 /usr/a 後 就卡在a 不 ...