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

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

Re: shell-command fails to execute shell function


From: ernest
Subject: Re: shell-command fails to execute shell function
Date: Tue, 11 Jan 2011 07:47:38 -0800 (PST)
User-agent: G2/1.0

On 10 Gen, 22:59, "Steven W. Orr" <ste...@syslang.net> wrote:
> On 1/10/2011 9:40 AM, ernest wrote:
>
> > Hi,
> > I have a shell function defined in ~/.bashrc.
> > When I try to run the function with shell-command, it fails with:
> > /bin/bash: fm: command not found
> > "fm" being the function's name.
> > I suppose I could precede every command with "source ~/.bashr"
> > but I'm sure there must be something more appropriate.
> > Any comment welcome.
> > Ernest
>
> When you log in you run the .bash_profile. If you have a .bashrc then it's the
> responsibility of the .bash_profile to run the .bashrc. If you run a
> non-interactive script which depends on a function which is defined in the
> .bashrc then you will not by default get those functions. If you *really*
> think this is what you want, you need to look at the BASH_ENV variable.
>
> Do not set any env vars in your .bashrc unless you need them for remote
> commands. In that case, your .bashrc should check to see if it is running
> non-interactive and set those very few env vars that you really think you
> need. But, always set them in the .bash_profile.

I thought .bashrc was read when the shell was non-interactive too.
Looks like I was wrong. So, non-interactive shells do not read any
init file, unless you explicitly set the BASH_ENV variable . . . Ok,
thanks!
--
Ernest


reply via email to

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