unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: William Xu <william.xwl@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: quote bashslash in a shell command
Date: Mon, 07 Jul 2014 00:01:27 +0800	[thread overview]
Message-ID: <lpbrso$9gh$1@ger.gmane.org> (raw)

The shell command is:
  echo foo.bar | sed -e 's/\..*//'

which will produce "foo" on bash.

If i try to pass it to shell-command-to-string:
  (shell-command-to-string "echo foo.bar | sed -e 's/\..*//'")
	=> "\n"

Then i find i need to quote the backslash in emacs once more:
  (shell-command-to-string "echo foo.bar | sed -e 's/\\..*//'")
	=> "foo\n"

Is there a function or other way that can handle this kind of backslash
quoting automatically?


-William




             reply	other threads:[~2014-07-06 16:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-06 16:01 William Xu [this message]
     [not found] <mailman.4940.1404662528.1147.help-gnu-emacs@gnu.org>
2014-07-06 16:22 ` quote bashslash in a shell command Pascal J. Bourguignon
2014-07-07  6:27   ` William Xu
2014-07-07 11:34     ` Aurélien Aptel
2014-07-07 15:27     ` Pascal J. Bourguignon
2014-07-08  3:59       ` William Xu
2014-07-08  5:04         ` Pascal J. Bourguignon
     [not found]   ` <mailman.4987.1404714478.1147.help-gnu-emacs@gnu.org>
2014-07-08  7:49     ` jduthen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='lpbrso$9gh$1@ger.gmane.org' \
    --to=william.xwl@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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).