bashrc中不加载,直到运行bash命令 [英] bashrc not loading until run bash command

查看:678
本文介绍了bashrc中不加载,直到运行bash命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行新安装的Arch Linux。当我登录到用户(运行bash),并尝试使用别名从.bashrc中,它给了我错误未找到命令。但是,如果我通过'庆典'命令重新进入bash中,该命令的作用就好了。

I am running freshly installed Arch Linux. When I log into a user (running bash) and try to use an alias from .bashrc, it gives me the 'command not found' error. But, if I reenter bash via the 'bash' command, the command works just fine.

是的,我已经在bash。

Yes, I am already in bash.

ENV开始:

SHELL=/usr/bin/bash

运行bash后包膜,它仍然是:

env after running bash, it remains:

SHELL=/usr/bin/bash

所以我不太清楚问题出在哪里。

So I'm not quite sure where the problem is.

推荐答案

阅读从调用部分的bash(1)的全部细节(这是对于bash手册页;用人的bash)。在登录你的第一个壳是一个登录shell,这意味着.bashrc文件不采购。你的第二个调用创建一个交互式的shell,其中的.bashrc的来源。

Read the INVOCATION section from bash(1) for full details (that's the man page for bash; use "man bash"). Your first shell upon logging in is a "login shell", which means that the .bashrc file is not sourced. Your second invocation creates an interactive shell, where .bashrc is sourced.

如果你总是希望你的.bashrc文件的处理的内容,您可以添加类似以下内容到你的.bash_login文件文件:

If you always want the content of your .bashrc file processed, you might add something like the following to your .bash_login file:

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

这篇关于bashrc中不加载,直到运行bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆