From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.help Subject: Re: Executing bash bash script from emacs / elisp Date: Fri, 3 Sep 2010 13:42:53 +0200 Message-ID: References: <4C80D914.8000106@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1283514246 19251 80.91.229.12 (3 Sep 2010 11:44:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Sep 2010 11:44:06 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: R.M.Krug@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 03 13:44:05 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 1OrUgc-0000XT-Fh for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Sep 2010 13:44:02 +0200 Original-Received: from localhost ([127.0.0.1]:54072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrUgZ-0001Mv-VI for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Sep 2010 07:43:59 -0400 Original-Received: from [140.186.70.92] (port=50724 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrUg8-0001Mp-Kn for help-gnu-emacs@gnu.org; Fri, 03 Sep 2010 07:43:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OrUg7-0003fp-40 for help-gnu-emacs@gnu.org; Fri, 03 Sep 2010 07:43:32 -0400 Original-Received: from mail-gy0-f169.google.com ([209.85.160.169]:41687) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OrUg7-0003fj-0a for help-gnu-emacs@gnu.org; Fri, 03 Sep 2010 07:43:31 -0400 Original-Received: by gyf3 with SMTP id 3so916695gyf.0 for ; Fri, 03 Sep 2010 04:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=HayoRLMrQfo9HLRP+PGV4IFua5aYNXeozfMv00xkE5U=; b=abmjgfJwiumTM7pe4Am+ShQ93ah3NgmH8msweBxiNzuvCmKEXUlxpNh2nNq/yH12z0 CexBXwEIbIRPIZPjCgBhvl0sec5CK4zUtVAMAfLxR/PMMcrf9GMk+i3StrufTdLUvOuu +BfM7vYNLc6WdTc4QzsZBnt1AKf/nT8GD9LWY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=Om6nsKTXo2k7I2CZa3fjJ8Z2KsK5Sl/TrFkL7DUzhkpmyzDM4WcezrQioCN5u4A+zn XGO5mN3qTd6/sbB4bS7QqkVgjrxSMIbIJDd9TS6RDdr4IRxtvma9FY3Oi9SBKoA5nT+J DFre51dNfVOjk715io0tOFnEfXV68md1xPGjI= Original-Received: by 10.90.98.4 with SMTP id v4mr675685agb.131.1283514204908; Fri, 03 Sep 2010 04:43:24 -0700 (PDT) Original-Received: by 10.220.200.195 with HTTP; Fri, 3 Sep 2010 04:42:53 -0700 (PDT) In-Reply-To: <4C80D914.8000106@gmail.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:74859 Archived-At: 2010/9/3 Rainer M Krug : > -----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? > Those two functions are interactive, i.e. they can be called by the user directly using e.g. M-x shell-command. Nothing stops you from using them, but they both basically just wrap call-process in a bunch of user interaction handling. > 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? > Yes, it should be enough to simply set the OUTPUT-BUFFER argument to nil to tell Emacs not to print the output anywhere, hence not creating a buffer for the process. -- Deniz Dogan