当我在Ubuntu12.04中打开一个新的终端窗口时,.bashrc
中的代码不会执行。我在创建.bash_aliases
文件时注意到了这一点。当我打开一个新的终点站时,化名没有出现。但是,当我键入source .bashrc
时,确实会出现别名。
每次我打开一个新的终端窗口时都应该运行.bashrc
,对吗?
我怎样才能做到这一点?
发布于 2017-01-10 04:42:14
.bash_profile
保存bash的配置。当您打开一个终端时,它首先从~/.bash_profile
读取和执行命令。因此,您可以在.bash_profile
中添加以下内容,以便根据bashrc设置shell。
. ~/.bashrc
发布于 2019-06-02 23:19:01
根据.profile
中的评论
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
这样就可以了;如果存在~/.bash_profile
或~/.bash_login
,那么它们将被运行而不是~/.profile
。
如果您想运行~/.bashrc
,只需在bash_profile
中添加行source ~/.bashrc
。
发布于 2013-11-11 05:53:05
如果没有设置$BASH_VERSION
,请尝试使用chsh
命令将您的shell设置为/bin/bash
。
我对12.04LTS也有类似的问题,结果发现新用户帐户的默认shell设置为/bin/sh
,这就是问题的原因。
https://askubuntu.com/questions/161249
复制相似问题