[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

quote bashslash in a shell command

From: William Xu
Subject: quote bashslash in a shell command
Date: Mon, 07 Jul 2014 00:01:27 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

The shell command is:
  echo | 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 | sed -e 's/\..*//'")
        => "\n"

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

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]