close

商業翻譯

裝完了Bash,發現色彩超等單一,有點不太好辨認

本文在此做個簡單的摘要,輕易本身浏覽利用


完成後,你就可以看到美美的Bash了!

source .bashrc

 

 

如果翻譯公司碰到了跟我一樣的問題

於是乎,華頓翻譯公司將我的PS1變數設置於以下:

裝過幾個Linux以後,發現Gentoo的色采設置裝備擺設還真的相當好看

剛剛在從新設定新的Server的時候

 

 

 

跟著指令字元太多,沒法准確換行,籠蓋了本來第一行的文字

別的,還有文字的樣式

如許子,每次登入bash就會本身去找bashrc來更新設定檔囉!

#0

Color Foreground Background
Black 30 40
Red 31 41
Green 32 42
Yellow 33 43
Blue 34 44
Purple 35 45
Cyan 36 46
White 37 47

然後,在文字格局的前面必需加上 \e[ 當做花樣的開首,並以 \e[m 作為格局結尾

不外,你會發現,第一次登入該機器的時辰,Bash仍是單調的色采,都沒變阿

這時候,只需要在本身的家目錄再成立一個 .bash_profile


所以參數設定的前後,一定要以 \[ & \] 作為開首與結尾!!

所以整個文字的花樣就要如許暗示: 樣式 ; 色碼 m


還記得本文最上方那張圖嗎?

中心是以分號作為區隔

\a     an ASCII bell character (07)
\d     the  date  in  "Weekday  Month  Date" format (e.g.翻譯社 "Tue May 26")
\e     an ASCII escape character (033)
\h     the hostname up to the first `.'
\H     the hostname

     newline
\r     carriage return
\s     the name of the shell, the  basename  of  $0  (the portion following the final slash)
\t     the current time in 24-hour HH:MM:SS format
\T     the current time in 12-hour HH:MM:SS format
\@     the current time in 12-hour am/pm format
\u     the username of the current user
\v     the version of bash (e.g., 2.00)
\V     the  release  of  bash, version + patchlevel   (e.g., 2.00.0)
\w     the current working directory
\W     the basename of the current  working  directory
\!     the history number of this command
\#     the command number of this command
\$     if  the effective UID is 0, a #翻譯社 otherwise a $

nn   the character  corresponding  to  the  octal number nnn
\\     a backslash
\[     begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
\]     end a sequence of non-printing characters

 

接下來,就是功能參數

然後將以上字串寫入到 ~/.bashrc 裡面

export PS1="\[\e[0;31m\]\u@\[\e[m\e[0;34m\]\h\[\e[m \e[0;32m\]\W \$\[\e[m\]"

 

 

所以,從網路上找到了以下的Shell Color code:Colorizing shell scripts

原本這裡括號的方式有誤,此刻已更正,也就是除非凡變數之外,都要加上\[ \] !!

色碼表:

老是要在打一次 bash 這個指令才會更新色彩!!

裡面的內容打上:

於是決意動手修改了Bash的PS1參數

這代表PS1參數設定不准確,讓Bash沒法准確判讀哪邊是non-printing characters

ANSI code Meaning
0 Normal Characters
1 Bold Characters
4 Underlined Characters
5 Blinking Characters
7 Reverse video Characters


本篇文章引用自此: http://blog.xuite.net/sphjlc062218/thinking/63628944-%5BUnix%5D+%E8%AE%93Bash%E5%A2%9E%E6%B7%BB%E8%8有關各國語文翻譯公證的問題歡迎諮詢華頓翻譯公司02-77260932
arrow
arrow
    文章標籤
    翻譯社
    全站熱搜
    創作者介紹
    創作者 lanex363538lb 的頭像
    lanex363538lb

    這裡是和天成翻譯有關的地盤,歡迎到訪我的BLOG!

    lanex363538lb 發表在 痞客邦 留言(0) 人氣()