[問題] shell color

看板Linux作者 (卯)時間14年前 (2011/07/18 13:33), 編輯推噓1(104)
留言5則, 3人參與, 最新討論串1/1
請教一下各位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" -- ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.123.105.91

07/18 14:09, , 1F
我直覺是你的script print的部分有錯, po上來看看?
07/18 14:09, 1F
※ 編輯: godman362 來自: 140.123.105.91 (07/18 14:53)

07/18 14:54, , 2F
已補上printf的實做code,請先進指點
07/18 14:54, 2F


07/18 15:27, , 4F
附上實際情況的貼圖
07/18 15:27, 4F

07/18 17:14, , 5F
where's your code?
07/18 17:14, 5F
文章代碼(AID): #1E8yN5uC (Linux)