分页: 1 / 3

☎ 彩色提示符

发表于 : 2007-07-18 20:02
eexpress
~/.bashrc里面改了下。
PS1='\[\033[0;31;47m\t\033[0;33;44m\u\033[4;32;40m\w\033[0m\] '

没事作,搞了玩玩。

测试颜色的bash。

代码: 全选

$●  cat color.bash 
#!/bin/sh
############################################################
# Nico Golde <nico(at)ngolde.de> Homepage: http://www.ngolde.de
# Last change: Mon Feb 16 16:24:41 CET 2004
############################################################

for attr in 0 1 4 5 7 ; do
    echo "----------------------------------------------------------------"
    printf "ESC[%s;Foreground;Background - \n" $attr
    for fore in 30 31 32 33 34 35 36 37; do
        for back in 40 41 42 43 44 45 46 47; do
            printf '\033[%s;%s;%sm %02s;%02s  ' $attr $fore $back $fore $back
        done
    printf '\n'
    done
    printf '\033[0m'
done

发表于 : 2007-07-22 15:05
eexpress
home end定位有问题。没人试试?

发表于 : 2007-07-22 15:09
BigSnake.NET
图片
我的

发表于 : 2007-07-22 15:11
eexpress
原来正式的是网蛇,而不是球猫。
你的home end定位没问题,就是输入了命令,home到前面去修改的情况?

发表于 : 2007-07-22 15:12
BigSnake.NET
eexpress 写了:原来正式的是网蛇,而不是球猫。
你的home end定位没问题,就是输入了命令,home到前面去修改的情况?
什麽意思?不明白

发表于 : 2007-07-22 15:38
eexpress
原来没一个颜色设置,都要\[和\]包括。nnnnd

发表于 : 2007-07-24 14:57
eexpress
在某种不确定的情况下,会突然出现全部输入乱定位的情况。@@@@@

发表于 : 2007-08-15 19:33
eexpress
unicode 字符 ☎,2边都要空格。

发表于 : 2007-08-20 8:45
leeyee

代码: 全选

export PS1="\[\e[36;1m\]\u@\[\e[32;1m\]\H\[\e[31;1m\]> \[\e[0m\]"
文件彩色显示用的是dircolors:

代码: 全选

leeyee@alimus> cat .dircolors 
# 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 01;34 # directory
LINK 01;36 # 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 01;32
# 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
.tar 01;31 # archives or compressed (bright red)
.tgz 01;31
.arj 01;31
.taz 01;31
.lzh 01;31
.zip 01;31
.7z 01;31
.z 01;31
.Z 01;31
.gz 01;31
.bz2 01;31
.deb 01;31
.rpm 01;31
.jar 01;31
.rar 01;31
# image formats
.jpg 01;35
.jpeg 01;35
.gif 01;35
.bmp 01;35
.pbm 01;35
.pgm 01;35
.ppm 01;35
.tga 01;35
.xbm 01;35
.xpm 01;35
.tif 01;35
.tiff 01;35
.png 01;35
.mov 01;35
.mpg 01;35
.mpeg 01;35
.wmv 01;35
.avi 01;35
.rm 01;35
.rmvb 01;35
.fli 01;35
.gl 01;35
.dl 01;35
.xcf 01;35
.xwd 01;35
# audio formats
.flac 01;35
.wma 01;35
.Wma 01;35
.WMA 01;35
.mp3 01;35
.Mp3 01;35
.MP3 01;35
.mpc 01;35
.ogg 01;35
.wav 01;35
# programming language
.c 01;32
.m 01;32
.awk 01;32
.gpt 01;32
.v 01;32

发表于 : 2007-08-20 9:02
bones7456
这些颜色的详细资料哪里有啊?

发表于 : 2007-08-20 9:25
eexpress
bones7456 写了:这些颜色的详细资料哪里有啊?
网上到处有。你不如测试1楼的bash。一目了然。

发表于 : 2007-08-20 9:27
iblicf
bash ,, sed 有些语义太 tm 缺可读性了,

发表于 : 2007-08-20 9:39
eexpress
iblicf sed语法是晦涩。问题是,你在说什么那。这里那有sed??

发表于 : 2007-08-20 9:43
iblicf
联想一下不行?

发表于 : 2007-08-20 9:47
bones7456
eexpress 写了:
bones7456 写了:这些颜色的详细资料哪里有啊?
网上到处有。你不如测试1楼的bash。一目了然。
呵呵,就是测试那个bash,觉得不错,才想找到类似“\033[X;X;X XX;XX”这样的语法到底什么含义啊~还有那bash里面是所有的颜色了吗?为什么前景色是30~37,背景是40~47?字型又是0,1,4,5,7。迷糊中啊~~