help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: executing bash function with shell-command


From: Emanuel Berg
Subject: Re: executing bash function with shell-command
Date: Tue, 23 Feb 2016 01:34:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> It is because when you open bash from Emacs bash is
> the interactive shell. When you open Emacs from bash
> Emacs talks to a non-interactive bash where BASH_ENV
> is the only thing that is sourced. (Or so I've heard
> - I don't use bash myself - I use zsh, where you
> solve this by putting shared stuff in .zshenv)
>
> So try putting the shared file path in BASH_ENV, or
> you can even try:
>
>     BASH_ENV=~/.bashrc emacs

Yes, this works for me even tho I'm on zsh.

In ~/.bashrc put this, carefully, as bash is fussy!

    function hi () {
        echo hello
    }

Then invoke Emacs like this:

    SHELL=/bin/bash BASH_ENV=~/.bashrc emacs -Q

Then:

    M-x shell-command RET hi RET

N.B. Don't rely on SHELL if you want to change the
shell in general. 

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]