QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1610|回复: 9

求助,我的命令行始终为bash-2.05b#,看不到目录啊,

[复制链接]
发表于 2004-3-16 15:44:18 | 显示全部楼层 |阅读模式
高手帮一下
发表于 2004-3-16 15:54:09 | 显示全部楼层
能详细一点吗?
什么状态下看不到目录?
ls ?
回复

使用道具 举报

发表于 2004-3-16 16:09:31 | 显示全部楼层
看一下你的/etc/bashrc
以下是我的:
# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
        umask 002
else
        umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
    case $TERM in
        xterm*)
                if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
                else
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
               fi
                ;;
        screen)
                if [ -e /etc/sysconfig/bash-prompt-screen ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
                else
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
                fi
                ;;
        *)
                [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
            ;;
    esac
    # Turn on checkwinsize
    shopt -s checkwinsize
    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
     
    if [ "x$SHLVL" != "x1" ]; then # We're not a login shell
        for i in /etc/profile.d/*.sh; do
            if [ -r "$i" ]; then
                . $i
            fi
        done
    fi
fi
# vim:ts=4:sw=4

如果正常,请在你的home里建立.bashrc
# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
回复

使用道具 举报

 楼主| 发表于 2004-3-16 21:05:46 | 显示全部楼层
这时我的,而且原来用于表示文件类型不同的颜色也没有了,我记得 我动过 察看方式的设置 后 九成这样了
# System wide functions and aliases
# Environment stuff goes in /etc/profile
                                                                                
# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then
    umask 002
else
    umask 022
fi
                                                                                
# are we an interactive shell?
if [ "$PS1" ]; then
    if [ -x /usr/bin/tput ]; then
      if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal
        stty erase `tput kbs`
      elif [ -x /usr/bin/wc ]; then
        if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb" terminal
          stty erase `tput kbs`
        fi
"bashrc" 56L, 1497C
回复

使用道具 举报

 楼主| 发表于 2004-3-16 22:02:43 | 显示全部楼层
通过设置终端的配置文件现在颜色有了,但是命令行还是这样
-bash-2.05b# cd ..
-bash-2.05b# ls
bin   dev  home    lib         misc  opt   root  tmp  var
boot  etc  initrd  lost+found  mnt   proc  sbin  usr
-bash-2.05b# cd home
-bash-2.05b#
回复

使用道具 举报

发表于 2004-3-16 22:22:57 | 显示全部楼层
设置一下您的 PS1 变量试试看。
回复

使用道具 举报

发表于 2004-3-18 01:42:20 | 显示全部楼层
建立用户时候出的问题应该是
最简单的方法是重新建立一个用户
上次我也这样
回复

使用道具 举报

 楼主| 发表于 2004-3-18 18:25:49 | 显示全部楼层
-bash-2.05b#  [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
[root@localhost root]#

我现在能看到,但是重新打开终端时,还是-bash-2.05b#,怎么保存
回复

使用道具 举报

发表于 2004-3-18 18:30:10 | 显示全部楼层
设置PS1:
在/etc/.bash_profile中加入
export PS1="[\u@\h \W]\\$ "
回复

使用道具 举报

发表于 2004-3-20 10:38:04 | 显示全部楼层
cd /mnt/sysimage  
  就能看到你的原本目录了吧
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-9-20 09:41 , Processed in 0.037569 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

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