替Prompt加上顏色

在prompt字串做變化:

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

PS1 提示符號的完整說明必須用man bash來查詢; 但bash的內容太多了, 不易瀏覽, 由Google找到

查詢man指令的網站: http://www.mediacollege.com/linux/man/index.html

可以顯示得較容易觀看. PS1的變更要找其內的PROMPTING, 特殊字元如下:

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
j the number of jobs currently managed by the shell
l the basename of the shell's terminal device name
n 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 $
nnn 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

##

您可能也會有興趣的類似文章

簡睿

服務於軟體業的資訊老兵。興趣廣泛,學習力佳,樂於分享所知所學。

您可能也會喜歡…

1 個回應

  1. 梁先生表示:

    簡先生你好:我想用AutoHotkey寫一個exe檔.來開啟上班時公司要開的程式.但是都無法成功.我沒抓座標.我是用捷徑寫入.底下是抓捷徑方法.有3個要寫入.請簡先生幫看抓法對不對.我抓捷徑的方法是:我分別點桌面3個圖示的內容.打開後3個裡面各有的捷徑.
    1.開啟位置(S)F:\Z 目標(T)F:\Z\EXE\csupdate.exe 目標位置EXE
    2.開啟位置(S)F:\DS 目標(T)F:\DS\RSDS.EXE 目標位置DS
    3.是免安裝火狐瀏覽器路徑 D:\My Documents\Tool\FirefoxPortable\App\Firefox\Firefox.exe

    PS:一般手動開啟火狐瀏覽器的捷徑D:\My Documents\Tool\FirefoxPortable只要在此點他圖示就可開啟.但是寫入AotuHotKet卻無法再此開啟.要進入APP裡點圖示才可開啟.

    底下是我用AotuHotKet寫法.按F12來啟動:
    $F12::
    {
    Send {e Down}
    E::run F:\Z\EXE\csupdate.exe
    Sleep 3000
    Send {c Down}
    C::run F:\DS\RSDS.EXE
    Sleep 3000
    Send {f Down}
    F::run D:\My Documents\Tool\FirefoxPortable\App\Firefox\Firefox.exe
    }

    但是按F12後都顯示錯誤.只有火狐瀏覽器打得開.但是此捷徑的命令會連開2個火狐網頁.為什麼?
    請簡先生幫解惑與指正.是捷徑抓法錯誤?還是寫法有誤? 感恩~

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *