all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Shell argument quoting woes
@ 2013-07-25 13:30 Thorsten Jolitz
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2013-07-25 13:30 UTC (permalink / raw)
  To: help-gnu-emacs


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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-25 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1758.1374759057.12400.help-gnu-emacs@gnu.org>
2013-07-25 14:51 ` Shell argument quoting woes Rustom Mody
2013-07-25 15:28   ` Thorsten Jolitz
     [not found]   ` <mailman.1765.1374766754.12400.help-gnu-emacs@gnu.org>
2013-07-25 16:46     ` Rustom Mody
2013-07-25 13:30 Thorsten Jolitz

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.