From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: William Xu Newsgroups: gmane.emacs.help Subject: quote bashslash in a shell command Date: Mon, 07 Jul 2014 00:01:27 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1404662548 10584 80.91.229.3 (6 Jul 2014 16:02:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Jul 2014 16:02:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 06 18:02:20 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 1X3otN-00049O-8A for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Jul 2014 18:02:17 +0200 Original-Received: from localhost ([::1]:46463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X3otM-0007Nv-Ri for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Jul 2014 12:02:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X3ot4-0007Nc-93 for help-gnu-emacs@gnu.org; Sun, 06 Jul 2014 12:02:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X3osv-00054I-Ao for help-gnu-emacs@gnu.org; Sun, 06 Jul 2014 12:01:58 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:50717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X3osv-000548-4k for help-gnu-emacs@gnu.org; Sun, 06 Jul 2014 12:01:49 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X3osn-0003Qi-IW for help-gnu-emacs@gnu.org; Sun, 06 Jul 2014 18:01:41 +0200 Original-Received: from 182.48.101.22 ([182.48.101.22]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Jul 2014 18:01:41 +0200 Original-Received: from william.xwl by 182.48.101.22 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Jul 2014 18:01:41 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 18 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 182.48.101.22 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:98550 Archived-At: 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