星期日, 七月 02, 2006
grep、man 顏色設定
既然 ls 顏色設好了, grep、man 當然也要對一些 keyword 來做做顏色區分囉~
grep 對要找的字做顏色標註, 只要用預設參數即可(--color), 所以在 .bashrc 寫個 alias 就好囉, 如下:
alias grep='grep --color'
man 的話需要在 .bashrc 最後面加以下幾行, 就可以輕鬆的看 man page 囉~
- # For colourful man pages (CLUG-Wiki style)
- export LESS_TERMCAP_mb=$'\E[01;31m'
- export LESS_TERMCAP_md=$'\E[01;31m'
- export LESS_TERMCAP_me=$'\E[0m'
- export LESS_TERMCAP_se=$'\E[0m'
- export LESS_TERMCAP_so=$'\E[01;44;33m'
- export LESS_TERMCAP_ue=$'\E[0m'
- export LESS_TERMCAP_us=$'\E[01;32m'
有圖有真相~ 見以下圖片:
- Screen 1: man ls
- Screen 2: grep --color 的結果
- Screen 3: grep 沒有 --color 的結果
man...我是用 most 來顯示顏色
http://blog.yam.com/chhuang/archives/1398083.html
又學到一招囉...^^ 謝謝
Comment by
翔
(07/02/2006 15:00)
發表迴響
PS: 若無法留言, 請先確認是否有打開 JavaScript, 造成您的困擾, 實在萬分對不起 Orz...(如果無法留言, 勞煩可以發信給我好嗎? 謝謝.)
PS2: 若您的留言被誤判, 我都會再自行看過, 不需要一直重覆張貼~
PS2: 若您的留言被誤判, 我都會再自行看過, 不需要一直重覆張貼~






