- 论坛徽章:
- 0
|
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}:!} "
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/322/showart_1138982.html |
|