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

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

问题描述

我有一些别名和在〜/ .bashrc定义的功能。

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

我使用Emacs的开始从终端窗口的emacs -nw

I start emacs from a terminal window using emacs -nw

当我执行 M-X的shell命令,从〜/ .bashrc中的别名和功能不可用,但给找不到命令。

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

我GOOGLE了相当多的,但所有我遇到的帖子说,如果我理解正确的他们,在〜/ .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外壳选项设置
  使用禁用了javascript
         (见禁用了javascript的说明下shell内建下面命令)。

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天全站免登陆