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: Steven W. Orr
Subject: Re: shell-command fails to execute shell function
Date: Mon, 10 Jan 2011 16:59:21 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

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.

--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



reply via email to

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