From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rainer M Krug Newsgroups: gmane.emacs.help Subject: Re: Executing bash bash script from emacs / elisp Date: Fri, 03 Sep 2010 13:16:36 +0200 Message-ID: <4C80D914.8000106@gmail.com> References: Reply-To: R.M.Krug@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1283519297 8889 80.91.229.12 (3 Sep 2010 13:08:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Sep 2010 13:08:17 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Deniz Dogan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 03 15:08:15 2010 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 1OrW07-0002hB-76 for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Sep 2010 15:08:15 +0200 Original-Received: from localhost ([127.0.0.1]:47567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrW06-0000Lq-Fs for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Sep 2010 09:08:14 -0400 Original-Received: from [140.186.70.92] (port=50305 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrUGE-0003IG-At for help-gnu-emacs@gnu.org; Fri, 03 Sep 2010 07:16:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OrUG8-0007ic-DF for help-gnu-emacs@gnu.org; Fri, 03 Sep 2010 07:16:41 -0400 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:56110) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OrUG8-0007iR-6t for help-gnu-emacs@gnu.org; Fri, 03 Sep 2010 07:16:40 -0400 Original-Received: by wyb36 with SMTP id 36so1828656wyb.0 for ; Fri, 03 Sep 2010 04:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=wQJGRehmmUZ2IHPUEnozVkK5l0nUmhmdoVeO26IP4cY=; b=LaHHp0fKWIA8nCaRjyQQcs1rlaFVokXY6MUq5fK23LSrUNuHGOTmZvQPApUuwZ1vQf //M9BHzhDvQlK3Dfr7VsET+ZlRh8rsBes//5fOdMxYb7pnSBduxZBR/yO7yO3kuqdwgj 3i5Vu+UNXnvArs1Hpwz1eJfDL3h5iLynJhBO0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=Rov0yg42hxxmwcO92LeMUFDuBj7BwnEQtFi0t/NMWTYs2f9SgVanI7aST3AiJIPlRA H2rBy5zH53SZ7rGQlotobe6e8seRWXyXL1+EtvJ2hfQP/0JG1F5KkGuhASqNxgddg+aP l7tlDTypHLH5uci3k3clcjY79iVUIrsKl2QY0= Original-Received: by 10.227.147.141 with SMTP id l13mr431614wbv.229.1283512599134; Fri, 03 Sep 2010 04:16:39 -0700 (PDT) Original-Received: from [192.168.0.10] (arn78-1-88-186-171-7.fbx.proxad.net [88.186.171.7]) by mx.google.com with ESMTPS id a1sm1423463wbb.2.2010.09.03.04.16.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 03 Sep 2010 04:16:38 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10pre) Gecko/20100903 Lightning/1.0b2 Shredder/3.1.4pre In-Reply-To: X-Enigmail-Version: 1.1.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Fri, 03 Sep 2010 09:03:30 -0400 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:74864 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 03/09/10 13:09, Deniz Dogan wrote: > 2010/9/3 Rainer M Krug : >> Hi >> I am a complete beginner concerning elisp - so please bear with me if >> this is a simple question. >> >> I would like to execute a shell (bash) script from elisp, which is then >> called from org-babel to do some post-processing of the result of >> tangling. Tangling in org-babel has a hook for post-processing, and I >> know how to set it. Therefore I am simply looking for a way of executing >> my shell script from that hook. >> >> essentially: >> >> this-function-executes-a-shell-script(The_Shell_Script.sh) >> >> Thanks, >> Rainer >> >> >> > > You want to look at the functions `call-process-shell-command' and > `call-process'. > > Example: > (call-process-shell-command "the_shell_script.sh" nil nil nil "arg1" "arg2") > > That's equivalent to running "the_shell_script.sh arg1 arg" in a shell. > Thanks a lot. After looking around I also found async-shell-command and shell-command. Am I right in assuming that, as the script is not producing any output, these commands are equivalent? In addition, when using async-shell-command I get asked "A command is running. Kill it? (yes or no)" Is there any way to avoid this? Cheers, Rainer - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Tel: +33 - (0)9 53 10 27 44 Cell: +27 - (0)8 39 47 90 42 Fax (SA): +27 - (0)8 65 16 27 82 Fax (D) : +49 - (0)3 21 21 25 22 44 Fax (FR): +33 - (0)9 58 10 27 44 email: Rainer@krugs.de Skype: RMkrug -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyA2RQACgkQoYgNqgF2egoyoACeL58SqUwn0qp71VpCGykKWwQW 3Z8AoIi+AmcmN9bPc1v4ExcU5nKeSatR =QS8P -----END PGP SIGNATURE-----