From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Steven W. Orr" Newsgroups: gmane.emacs.help Subject: Re: shell-command fails to execute shell function Date: Mon, 10 Jan 2011 16:59:21 -0500 Message-ID: <4D2B8139.1000308@syslang.net> References: <50126229-51c9-4bec-911d-1bb4095ef8ed@35g2000prb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1294696814 2040 80.91.229.12 (10 Jan 2011 22:00:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 10 Jan 2011 22:00:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 10 23:00:10 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PcPmS-0004wW-Sb for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Jan 2011 23:00:01 +0100 Original-Received: from localhost ([127.0.0.1]:45030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcPmS-0004Cz-9h for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Jan 2011 17:00:00 -0500 Original-Received: from [140.186.70.92] (port=46395 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcPlu-0004Bl-3O for help-gnu-emacs@gnu.org; Mon, 10 Jan 2011 16:59:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PcPls-00010V-O4 for help-gnu-emacs@gnu.org; Mon, 10 Jan 2011 16:59:26 -0500 Original-Received: from saturn.syslang.net ([207.172.210.41]:35759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PcPls-00010C-L2 for help-gnu-emacs@gnu.org; Mon, 10 Jan 2011 16:59:24 -0500 Original-Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1]) by saturn.syslang.net (8.14.3/8.14.3) with ESMTP id p0ALxLQ4032495 for ; Mon, 10 Jan 2011 16:59:22 -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 In-Reply-To: <50126229-51c9-4bec-911d-1bb4095ef8ed@35g2000prb.googlegroups.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78376 Archived-At: 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