From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jduthen@gmail.com Newsgroups: gmane.emacs.help Subject: Re: quote bashslash in a shell command Date: Tue, 8 Jul 2014 00:49:02 -0700 (PDT) Message-ID: References: <87mwcmqwx2.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1404949709 15636 80.91.229.3 (9 Jul 2014 23:48:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Jul 2014 23:48:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 10 01:48:21 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X51b3-0006bu-5o for geh-help-gnu-emacs@m.gmane.org; Thu, 10 Jul 2014 01:48:21 +0200 Original-Received: from localhost ([::1]:54558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4RAD-0006Ji-A5 for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Jul 2014 04:54:13 -0400 X-Received: by 10.183.10.133 with SMTP id ea5mr235854obd.24.1404805742582; Tue, 08 Jul 2014 00:49:02 -0700 (PDT) X-Received: by 10.140.97.162 with SMTP id m31mr224174qge.6.1404805742542; Tue, 08 Jul 2014 00:49:02 -0700 (PDT) Original-Path: usenet.stanford.edu!hn18no140770igb.0!news-out.google.com!a8ni13244qaq.1!nntp.google.com!m5no1229qaj.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=213.39.33.67; posting-account=rgX2qAoAAABSEvim9OouvBbR3ykJzh6C Original-NNTP-Posting-Host: 213.39.33.67 User-Agent: G2/1.0 Injection-Date: Tue, 08 Jul 2014 07:49:02 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:206306 X-Mailman-Approved-At: Tue, 08 Jul 2014 04:54:04 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:98608 Archived-At: Le lundi 7 juillet 2014 08:27:22 UTC+2, William Xu wrote=A0: > 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=3D$1; else read -r l; fi;=20 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(