LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 848|回复: 3

PS1是在哪里被定义的?

[复制链接]
发表于 2007-6-20 01:11:19 | 显示全部楼层 |阅读模式
看了
/etc/profile
/etc/bashrc
~/.bash_profile
~/.bashrc

都没见到有对它的定义
但是进入bash后可以见到:
[root@localhost ~]# echo "$PS1"
[\u@\h \W]\$
发表于 2007-6-20 07:38:19 | 显示全部楼层
脚本可以source其它文件的。
另外我的Ubuntu很简单:
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
  if [ "$BASH" ]; then
    PS1='\u@\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
        . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

umask 022
回复 支持 反对

使用道具 举报

发表于 2007-6-20 14:45:42 | 显示全部楼层
随便找个地方定义就是了,各个发行般都不太一样
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-6-20 17:01:57 | 显示全部楼层
Post by fuch
随便找个地方定义就是了,各个发行般都不太一样

我知道,但是我就是觉得没看到在哪定义觉得很奇怪,而且被设成的也不是默认值
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表