☎ 彩色提示符

仅供存放个人的配置文件,不要在本版发问。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

☎ 彩色提示符

#1

帖子 eexpress » 2007-07-18 20:02

~/.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
附件
screenshot-2007-07-18-20-02-19.png
上次由 eexpress 在 2007-10-19 11:22,总共编辑 1 次。
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#2

帖子 eexpress » 2007-07-22 15:05

home end定位有问题。没人试试?
● 鸣学
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#3

帖子 BigSnake.NET » 2007-07-22 15:09

图片
我的
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#4

帖子 eexpress » 2007-07-22 15:11

原来正式的是网蛇,而不是球猫。
你的home end定位没问题,就是输入了命令,home到前面去修改的情况?
● 鸣学
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#5

帖子 BigSnake.NET » 2007-07-22 15:12

eexpress 写了:原来正式的是网蛇,而不是球猫。
你的home end定位没问题,就是输入了命令,home到前面去修改的情况?
什麽意思?不明白
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#6

帖子 eexpress » 2007-07-22 15:38

原来没一个颜色设置,都要\[和\]包括。nnnnd
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#7

帖子 eexpress » 2007-07-24 14:57

在某种不确定的情况下,会突然出现全部输入乱定位的情况。@@@@@
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#8

帖子 eexpress » 2007-08-15 19:33

unicode 字符 ☎,2边都要空格。
● 鸣学
leeyee
帖子: 723
注册时间: 2006-04-11 9:01

#9

帖子 leeyee » 2007-08-20 8:45

代码: 全选

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
I would love to change the world, but they won't give me the source code.
http://hi.baidu.com/wienerlee
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

#10

帖子 bones7456 » 2007-08-20 9:02

这些颜色的详细资料哪里有啊?
关注我的blog: ε==3
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#11

帖子 eexpress » 2007-08-20 9:25

bones7456 写了:这些颜色的详细资料哪里有啊?
网上到处有。你不如测试1楼的bash。一目了然。
● 鸣学
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#12

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

bash ,, sed 有些语义太 tm 缺可读性了,
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#13

帖子 eexpress » 2007-08-20 9:39

iblicf sed语法是晦涩。问题是,你在说什么那。这里那有sed??
● 鸣学
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#14

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

联想一下不行?
头像
bones7456
帖子: 8495
注册时间: 2006-04-12 20:05
来自: 杭州
联系:

#15

帖子 bones7456 » 2007-08-20 9:47

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