all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Deniz Dogan <deniz.a.m.dogan@gmail.com>
To: R.M.Krug@gmail.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Executing bash bash script from emacs / elisp
Date: Fri, 3 Sep 2010 13:42:53 +0200	[thread overview]
Message-ID: <AANLkTinjffTgWdob0R4qCKBa6qD7kKv1TUKVU5=F-nEu@mail.gmail.com> (raw)
In-Reply-To: <4C80D914.8000106@gmail.com>

2010/9/3 Rainer M Krug <r.m.krug@gmail.com>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 03/09/10 13:09, Deniz Dogan wrote:
>> 2010/9/3 Rainer M Krug <R.M.Krug@gmail.com>:
>>> 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



  reply	other threads:[~2010-09-03 11:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03  9:20 Executing bash bash script from emacs / elisp Rainer M Krug
2010-09-03 11:09 ` Deniz Dogan
2010-09-03 11:16   ` Rainer M Krug
2010-09-03 11:42     ` Deniz Dogan [this message]
2010-09-03 12:41       ` Rainer M Krug
2010-09-03 11:44 ` Memnon Anon
     [not found] <mailman.4.1283506601.16808.help-gnu-emacs@gnu.org>
2010-09-03 12:03 ` Pascal J. Bourguignon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTinjffTgWdob0R4qCKBa6qD7kKv1TUKVU5=F-nEu@mail.gmail.com' \
    --to=deniz.a.m.dogan@gmail.com \
    --cc=R.M.Krug@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.