Chinaunix首页 | 论坛 | 博客
  • 博客访问: 48903
  • 博文数量: 6
  • 博客积分: 1688
  • 博客等级: 上尉
  • 技术积分: 120
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-16 15:11
文章分类

全部博文(6)

文章存档

2010年(2)

2008年(4)

最近访客

分类:

2008-08-22 10:44:21

Changing your prompt depends on what you want to do with it. The prompt is configured in your .profile. The variable is PS1. To set a prompt to reflect your hostname and current directory, you would have a line that looks like:
 
 

export PS1="{${HOSTNAME}:${PWD}:!} "

 

To have a prompt that reflects the current time, it would look like:

 

typeset -RZ2 _x1 _x2 _x3
let SECONDS=$(date '+3600*%H+60*%M+%S')
_s='(_x1=(SECONDS/3600)%24)==(_x2=(SECONDS/60)%60)==(_x3=SECONDS%60)'
TIME='"${_d[_s]}$_x1:$_x2:$_x3"'
export PS1=${TIME}

 

You can combine these two commands in this type of fashion:

 

export PS1="{${HOSTNAME}:${PWD}:${TIME}:!} "

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