Chinaunix首页 | 论坛 | 博客
  • 博客访问: 426433
  • 博文数量: 103
  • 博客积分: 5010
  • 博客等级: 大校
  • 技术积分: 971
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-11 17:22
文章分类
文章存档

2008年(77)

2007年(26)

我的朋友

分类:

2007-12-08 11:36:16

1.[xxxx@localhost test]$ echo $PS1
[\u@\h \W]\$
[xxxx@localhost test]$ su
Password:
[root@localhost test]# echo $PS1
[\u@\h \W]\$
[root@localhost test]# 
既然PS1的值没有发生变化,为什么root的提示符会变成#?
因为,PS1中变量中以\$来跳脱$字元的话,身份是root会自动的显示#,如果一般user则显示$,至于其它的\w,
\u,\h分别表示当前目录user名称和主机名称的第一段,和\$的意思一样,前面也是以\来跳脱它们具有特别的意义!


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