unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: jduthen@gmail.com
To: help-gnu-emacs@gnu.org
Subject: Re: quote bashslash in a shell command
Date: Tue, 8 Jul 2014 00:49:02 -0700 (PDT)	[thread overview]
Message-ID: <fc5b2b8e-69ce-470c-b5e1-91dc51677841@googlegroups.com> (raw)
In-Reply-To: <mailman.4987.1404714478.1147.help-gnu-emacs@gnu.org>

Le lundi 7 juillet 2014 08:27:22 UTC+2, William Xu wrote :
> What i'd like to have is that i try a shell command on bash,
> then i can simpy copy and paste in elisp.

You could also quote the backslashs from within the shell using 'qbs':

$ function qbs() { if [ $# -gt 0 ] ; then l=$1; else read -r l; fi; 
echo "$l" | sed -e 's/\\/\\\\/g'; }

$ echo foo.bar | sed -e 's/\..*//'
foo

# This command works. I want to quote the backslahs to copy it in emacs.
# So I copy and paste it into 'qbs'

$ qbs
echo foo.bar | sed -e 's/\..*//'    # <- This is what I copied/pasted
echo foo.bar | sed -e 's/\\..*//'   # <- This is what 'qbs' produces

# or pass it as argument to qbs:

$ qbs "echo foo.bar | sed -e 's/\..*//'"
echo foo.bar | sed -e 's/\\..*//'

HTH
)jack(


  parent reply	other threads:[~2014-07-08  7:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2014-07-06 16:01 William Xu

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=fc5b2b8e-69ce-470c-b5e1-91dc51677841@googlegroups.com \
    --to=jduthen@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).