Gnus development mailing list
 help / color / mirror / Atom feed
From: Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann)
Cc: ding@gnus.org
Subject: Re: Mechaincal question Show filename of # marked
Date: 22 Dec 2000 09:40:45 +0100	[thread overview]
Message-ID: <vafae9o6e7m.fsf@lucy.cs.uni-dortmund.de> (raw)
In-Reply-To: <m2wvct7orc.fsf@gnus-5.8.8-cvs.now.playing>

On 21 Dec 2000, Harry Putnam wrote:

> How can I feed that list to a shell script?  Can I pipe it to a shell
> script some how?

Let X be a list of strings ("one" "two" "three").
Suppose you want to run the following shell command:

    ./foo one two three

This can be done as follows: (mapconcat 'identity X " ") will produce a
string "one two three" from the list.  Then you just need to tack on
"./foo " to the beginning and feed the rest to `shell-command':

    (shell-command (concat "./foo "
                           (mapconcat 'identity X " ")))

You can also use `call-process' but there you will have to deal with a
little Lisp knowledge.  `call-process' directly calls the program in
question, without going through a shell.

Now the other question: piping the list of filenames to the command on
stdin.  That's also possible.  In principle, you start the program using
`start-process'.  The return value is a process object, and then you can
send input to this process using the `process-send-string' function.
This function needs the process object plus the string to send.  After
the last string, you can use `process-send-eof' to send end-of-file to
the process.

For going over the list and sending each string to the process, you can
use mapcar as suggested by Colin.

kai
-- 
~/.signature



      parent reply	other threads:[~2000-12-22  8:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-21  3:06 Harry Putnam
2000-12-21 10:02 ` Kai Großjohann
2000-12-21 14:28   ` Harry Putnam
2000-12-21 15:42 ` Kai Großjohann
2000-12-21 15:55   ` Harry Putnam
2000-12-22  3:15     ` Colin Walters
2000-12-22  5:10       ` Harry Putnam
2000-12-22  6:05         ` Colin Walters
2000-12-22  8:44         ` Kai Großjohann
2000-12-22  8:40     ` Kai Großjohann [this message]

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=vafae9o6e7m.fsf@lucy.cs.uni-dortmund.de \
    --to=kai.grossjohann@cs.uni-dortmund.de \
    --cc=ding@gnus.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).