可搜索,可注册,可登录,致敬逗比大佬!尽在救援版逗比根据地 dbgjd.com
投稿文章 | 广告合作 | Telegram 群组 / 公告频道 / 使用教程

登录Linux系统出现-bash-4.1

News rafaelamoffit21 530℃ 0评论

在登录测试环境的其中一台机器时,发现其命令提示框与别的机器不一样,-bash-4.1#,正常的则是[[email protected] ~]#,后来经过搜索找到解决方案,在此记录一下。

造成这种现象的原因是root用户的根目录下丢失了两个文件.bashrc.bash_profile,通常我们会把环境变量配置到这两个文件中的一个中,估计是哪位仁兄手滑个给删了吧,于是恢复如下:
新建.bashrc文件

1
vim ~/.bashrc

填入如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

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

新建.bash_profile文件

1
vim ~/.bash_profile

填入如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

以上两段内容是从别的机器上拷贝过来的。然后执行source ~/.bashrc,那么此时便已恢复正常。

转载请注明:逗比根据地 » 登录Linux系统出现-bash-4.1

喜欢 (0)
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址