来自 .bashrc 的命令在 Emacs 中不可用 [英] Commands from .bashrc not available in Emacs

查看:15
本文介绍了来自 .bashrc 的命令在 Emacs 中不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ~/.bashrc 中定义了一些别名和函数.

I have some aliases and functions defined in ~/.bashrc.

我使用 emacs -nw

当我执行 M-x shell-command 时,来自 ~/.bashrc 的别名和函数不可用,但给出找不到命令".

When I execute M-x shell-command, the aliases and functions from ~/.bashrc are not available, but give a "command not found".

我在谷歌上搜索了很多,但我遇到的所有帖子都说,如果我理解正确的话,~/.bashrc 是它应该工作的地方(而不是 ~/.profile 或 ~/.bash_profile).

I've googled quite a bit but all the posts I come across say, if I understand them correctly, that ~/.bashrc is the place where this should work (rather than ~/.profile or ~/.bash_profile).

我错过了什么?

推荐答案

别名仅在交互式 shell 中可用 - 来自 bash 手册页的快照:

Aliases are available only in interactive shell - a snapshot from bash man page:

别名不会在shell 不是交互式的,除非设置了 expand_aliases shell 选项使用shopt(请参阅下面 SHELL BUILTIN COMMANDS 下的 shopt 说明).

Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt (see the description of shopt under SHELL BUILTIN COMMANDS below).

这篇关于来自 .bashrc 的命令在 Emacs 中不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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