shell color - Linux

By Selena
at 2011-07-18T13:33
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"
--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
--
目前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

By Lydia
at 2011-07-22T22:44
at 2011-07-22T22:44

By Vanessa
at 2011-07-23T10:54
at 2011-07-23T10:54

By Kelly
at 2011-07-23T20:09
at 2011-07-23T20:09

By Noah
at 2011-07-23T21:41
at 2011-07-23T21:41

By Lydia
at 2011-07-28T03:24
at 2011-07-28T03:24
Related Posts
Flash 11 Beta

By Wallis
at 2011-07-18T12:06
at 2011-07-18T12:06
Flash 11 Beta

By Zanna
at 2011-07-18T11:40
at 2011-07-18T11:40
App Star 高手爭霸戰 開始報名!

By Adele
at 2011-07-18T11:07
at 2011-07-18T11:07
CentOS 6 DVD怎麼燒?

By Agatha
at 2011-07-18T07:27
at 2011-07-18T07:27
如何開機自動執行2個程式?

By Noah
at 2011-07-18T06:03
at 2011-07-18T06:03