☎ 彩色提示符

仅供存放个人的配置文件,不要在本版发问。
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#16

帖子 iblicf » 2007-08-20 9:53

\u - 当前用户名( =$LOGNAME)
\h - 运行shell的计算机名(hostname)
\H - 完整的计算机名
\W - 当前的工作目录名
\w - 当前工作目录全路径名
\$ - 对于普通用户显示$,对于超级用户显示#
\! - 当前命令的历史编号
\# - 当前命令编号(在当前的shell下运行的命令)
\d - 当前日期
\t - 当前时间(24小时制)
\T - 当前时间(12小时制 ,bash 2.0有效
\@ - 当前时间(AM/PM格式),bash 2.0 有效
\s - shell的类型
\a - 告警的声音
\j - 用户的任务数
\n - 新行
\\ - 反斜杠
\[ - 不可打印字符开始标志
\] - 不可打印字符结束标志
\nnn - ASCII字符对应八进制数值
$(date) - date命令(输出当前日期)或者其它的命令输出。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#17

帖子 eexpress » 2007-10-13 23:50

PS1='\[\e[31;47m\]\t \[\e[32;47m\]\u \[\e[37;40m\]\w ● '

搞晕的。不能使用彩色结束段,\[\e[0m\]。加上,就会遇到3个中文(unicode)和/相连的情况下,光标定位乱。
~/媒体/●我的图片
fish强大,中文更加bug多。

zsh,缺省的prompt就没问题,没设置彩色。
● 鸣学
头像
stlxv
论坛版主
帖子: 8275
注册时间: 2006-05-03 0:39
来自: المريخ

#18

帖子 stlxv » 2007-10-13 23:53

ee还真是闲
PHP是最好的语言!不服来战!
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#19

帖子 eexpress » 2007-10-14 10:50

闲。

没事改了改ls_colors

代码: 全选

dircolors --print-database>~/.exp_ls_colors
改了ln 和 ex 的颜色。使用1楼的那bash看颜色。

加入.bashrc,在eval "`dircolors -b`" 的后面。nnnnd,开始没注意,一直放前面。崽就有效。

代码: 全选

eval `dircolors ~/.exp_ls_colors`
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#20

帖子 eexpress » 2007-10-17 20:39

代码: 全选

☎  echo $PS1
\[\e[31;47m\]\t \[\e[32;47m\]\u \[\e[37;40m\]\w \e[m ☎
● 鸣学
头像
roylez
帖子: 1928
注册时间: 2005-10-04 10:59
来自: 上海

#21

帖子 roylez » 2007-10-17 20:44

eexpress 写了:闲。

没事改了改ls_colors

代码: 全选

dircolors --print-database>~/.exp_ls_colors
改了ln 和 ex 的颜色。使用1楼的那bash看颜色。

加入.bashrc,在eval "`dircolors -b`" 的后面。nnnnd,开始没注意,一直放前面。崽就有效。

代码: 全选

eval `dircolors ~/.exp_ls_colors`
ee,我发现你的口头禅了。
弄个dropbox空间来备份文件或者做私人代码服务器
配置:[url]git://github.com/roylez/dotfiles.git[/url]
主页:http://roylez.heroku.com
各种稀奇玩意儿:http://dooloo.info
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#22

帖子 eexpress » 2007-10-17 20:46

roylez
bo一个,就\e[m正常。再踩一下你,早不说这写法。
● 鸣学
头像
roylez
帖子: 1928
注册时间: 2005-10-04 10:59
来自: 上海

#23

帖子 roylez » 2007-10-17 20:50

帮你解决问题还踩……早知道多让你郁闷几天。
弄个dropbox空间来备份文件或者做私人代码服务器
配置:[url]git://github.com/roylez/dotfiles.git[/url]
主页:http://roylez.heroku.com
各种稀奇玩意儿:http://dooloo.info
头像
zhuqin_83
帖子: 10606
注册时间: 2006-05-13 4:02
联系:

#24

帖子 zhuqin_83 » 2007-10-17 21:37

嫌麻烦或者想学习一下的话,看看这里
http://www.nanolx.org/index.php?option= ... 7&Itemid=1
装个软件,自己琢磨去。人家脚本和配置都很全的。
附件
Screenshot-终端.png
screenshot1.png
HP Pavilion DV6-2064CA: AMD Turion II Ultra Dual-Core Mobile M640, HD4650, 2GBx2 DDR2-800, Seagate 500GB 7200RPM SATA, BD-ROM
DELL UltraSharp 2209WA
Arch64, Testing repo
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#25

帖子 BigSnake.NET » 2007-10-17 21:41

zhuqin_83 写了:嫌麻烦或者想学习一下的话,看看这里
http://www.nanolx.org/index.php?option= ... 7&Itemid=1
装个软件,自己琢磨去。人家脚本和配置都很全的。
酷毙了
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

#26

帖子 bones7456 » 2007-10-18 17:14

eexpress 写了:

代码: 全选

☎  echo $PS1
\[\e[31;47m\]\t \[\e[32;47m\]\u \[\e[37;40m\]\w \e[m ☎
ee,你这个的定位还是有问题的,全英文的路径home定位都错的...
关注我的blog: ε==3
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#27

帖子 eexpress » 2007-10-19 11:12

bone的\n的方法不错的。一劳永逸。呵呵。

代码: 全选

☎  cat .exp_ls_colors 
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM linux-c
TERM mach-color
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM cygwin
TERM dtterm
TERM mlterm
TERM putty
TERM xterm
TERM xterm-color
TERM xterm-debian
TERM rxvt
TERM rxvt-unicode
TERM screen
TERM screen-bce
TERM screen-w
TERM vt100
TERM Eterm
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 00;33;47 # directory
LINK 00;35 # symbolic link. (If you set this to 'target' instead of a
 # numerical value, the color is as for the file pointed to.)
FIFO 40;33 # pipe
SOCK 01;35 # socket
DOOR 01;35 # door
BLK 40;33;01 # block device driver
CHR 40;33;01 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 04;33
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
# If you use DOS-style suffixes, you may want to uncomment the following:
#.cmd 01;32 # executables (bright green)
#.exe 01;32
#.com 01;32
#.btm 01;32
#.bat 01;32
#
# archives or compressed (bright red)
.tar 00;31 
.tgz 00;31
.arj 00;31
.taz 00;31
.lzh 00;31
.zip 00;31
.z 00;31
.Z 00;31
.gz 00;31
.bz2 00;31
.deb 00;31
.rpm 00;31
.jar 00;31
# image formats
.jpg 00;34
.jpeg 00;34
.gif 00;34
.bmp 00;34
.pbm 00;34
.pgm 00;34
.ppm 00;34
.tga 00;34
.xbm 00;34
.xpm 00;34
.tif 00;34
.tiff 00;34
.png 00;34
.svg 00;34
.xcf 00;34
.mov 00;33
.mpg 00;33
.mpeg 00;33
.avi 00;33
.fli 00;33
.gl 00;33
.dl 00;33
.swf 00;33
.xwd 00;33
.3gp 00;33
# audio formats
.flac 00;32
.mp3 00;32
.mpc 00;32
.ogg 00;32
.wav 00;32

● 鸣学
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

#28

帖子 bones7456 » 2007-10-19 15:56

代码: 全选

\[\e[01;31;44m\]\u\[\e[00;33;44m\]@\[\e[01;31;44m\]\h\[\e[00m\]:\[\e[04;34;47m\]\w\[\e[00m\]$
这样,目前还没发现什么瑕疵...
关注我的blog: ε==3
头像
cyf3732
帖子: 174
注册时间: 2006-07-24 19:22

#29

帖子 cyf3732 » 2007-10-31 15:52

恩恩,这个有意思
留个Mark,考试完了回来研究
yuffey
帖子: 193
注册时间: 2007-09-06 16:24
来自: 中国上海

#30

帖子 yuffey » 2007-10-31 18:38

在Emacs乱码阿。
回复