Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1070455
  • 博文数量: 186
  • 博客积分: 4939
  • 博客等级: 上校
  • 技术积分: 2075
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-08 17:15
文章分类

全部博文(186)

文章存档

2018年(1)

2017年(3)

2016年(11)

2015年(42)

2014年(21)

2013年(9)

2012年(18)

2011年(46)

2010年(35)

分类: 系统运维

2013-08-30 10:43:49

   作为一个经常在服务器之间频繁切换做各种操作的人,一不小心可能就搞错了主机/路径,万一做了危险的操作那就麻烦了。原来的提示符枯燥又不能提示你。所以可以设置好玩/醒目的提示符,例如:


PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\H:\[\033[33;1m\]\w\[\033[m\]\\[\033[35m\]\t$ "


这样hostname/user/path/time一目了然,更多设置参见:



不光bash,MySQL也有,看看官方的manual:

Use an environment variable. You can set the MYSQL_PS1 environment variable to a prompt string. For example:
shell> export MYSQL_PS1="(\u@\h) [\d]> "
Use a command-line option. You can set the --prompt option on the command line to mysql. For example:
shell> mysql --prompt="(\u@\h) [\d]> "
() [database]>

用户/主机/db一目了然,这样你drop/truncate也胸有成竹了。

通过以下链接可以看到更多,please refer to the manual that corresponds with your MySQL version for the latest settings.

http://dev.mysql.com/doc/refman/5.0/en/mysql-commands.html

阅读(1355) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~