help-gnu-emacs
[Top][All Lists]
Advanced

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

Shell argument quoting woes


From: Thorsten Jolitz
Subject: Shell argument quoting woes
Date: Thu, 25 Jul 2013 15:30:32 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Hi List, 

assume this works in a shell

,------------------------
| $ prg -'fun "strg" num'
`------------------------

with 'prg' being a shell-command (for bash on GNU/Linux) calling a program,
'fun' being a function defined in that program, 'strg' being a string argument
to that function, and 'num' being a numeric argument to that function.

The task is to make a string out of this in an Elisp program and give
this 'cmd' as single argument to an Elisp function that then does
something like

#+begin_src emacs-lisp
(let ((cmdlist (split-string cmd)))
  (set-buffer (apply 'make-comint "buffer-name" (car cmdlist)
                     nil (cdr cmdlist) ) ))
#+end_src

Experimenting with (format "%s %S etc" ...) and (shell-quote-argument..) did
not result in anything that works. It seems the outcome is either

,--------------------
| prg -'fun strg num'
`--------------------

or

,------------------------
| prg -'fun \"strg\" num'
`------------------------

or

,--------------------------------
| prg\\ -\\'fun\\ \\\"strg\\\"\\ num\\'
`--------------------------------

or something similar, all resulting in errors.

Trying to replace the single quotes in that line with double-quote did not
work either.

How can I quote such a 'cmd' string in a way that it finally arrives as

,------------------------
| $ prg -'fun "strg" num'
`------------------------

?

-- 
cheers,
Thorsten




reply via email to

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