I am trying to duplicate the following bash command in Elisp:

curl https://google.com | readability https://google.com

Here's what I have so far, but it doesn't capture the piping "| readability" part of it. How can I use Elisp to pass info that will be interpreted as "from stdin"?

(shell-command-to-string (format "readability %s \n%s" url htmls))
  • 1
    I cant fathom how your elisp is supposed to be a replica for the original command. You're not calling curl at all, there's a newline in there for some reason... your question is very confusing.
    – phils
    Jun 5, 2021 at 21:48
  • (shell-command-to-string (format "ls -lah %s | head -n%s" "~/" "10")) this works, so I'd say it's something with your call to readability, which I don't know what it is.
    – Muihlinn
    Jun 5, 2021 at 21:59
  • emacs.stackexchange.com/tags/elisp/info
    – Drew
    Jun 5, 2021 at 22:53
  • Cross-referencing with emacs.stackexchange.com/questions/66321/…
    – phils
    Jun 15, 2021 at 21:32

1 Answer 1


The shell handles the pipelines, so there's no reason why the command you give shell-command-to-string can't include pipes.

(shell-command-to-string "curl 'https://google.com' 2>/dev/null | wc")
  • The original question was really broken, but I really appreciate the 2>/dev/null, which saved my bacon when I came back for it today Jun 8, 2021 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.