替Prompt加上顏色
在prompt字串做變化:
- username@host: export PS1='n u@h W'
- 增加顏色 PS1='n u@h e[32m W'
- 另一範例: export PS1='n u@h e[32m W e[0m'
http://www.linux.com/article.pl?sid=04/11/16/1753219
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
##
您可能也會有興趣的類似文章
- 開始使用Cygwin以取代cmd.exe (2則留言, 2007/01/11)
- [Windows] 去除環境變數DATE與TIME內的空白 (0則留言, 2008/04/20)
- [DOS] 以set指令的替換字串功能來解決資料夾重覆附加的小問題 (0則留言, 2016/03/07)
- [Vista] 設定環境變數SET命令的擴充 (0則留言, 2008/04/19)
- Command Prompt Explorer Bar: 將DOS視窗嵌入檔案總管 (4則留言, 2010/01/23)
- Obsidian Windows批次檔與AutoHotkey 語法高亮的用法 (2則留言, 2024/03/10)
- [Windows] 比對檔案時間並拷貝較新檔案的命令行作法 (0則留言, 2023/02/10)
- 在命令提示字元取得目前資料夾路徑的方法—使用set /p|初學者的命令行#10 (0則留言, 2021/04/22)
- [Cygwin] 與常用DOS命令的對應簡表 (4則留言, 2007/01/19)
- RTF另存檔成DOC的VBS程式 (3則留言, 2006/06/01)
- [Batch #4] 用批次檔簡化複雜的指令—直接叫用特定的ms-settings (初學者的命令行#8) (0則留言, 2020/08/15)
- [Batch#2] 三個方便的Windows批次檔範例 (初學者的命令行 #6) (0則留言, 2019/12/26)
- [Batch#1] Windows批次檔-取得系統日期的簡單方法與環境變數字串操作 (初學者的命令行 #5) (2則留言, 2019/12/15)
- 快速找出類別所在jar檔的命令行工具:LibraryFinder (0則留言, 2016/02/18)
- 如何用批次指令取得上個月的月份-再修訂版 (12則留言, 2008/10/21)
簡先生你好:我想用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個火狐網頁.為什麼?
請簡先生幫解惑與指正.是捷徑抓法錯誤?還是寫法有誤? 感恩~