all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Shell argument quoting woes
Date: Thu, 25 Jul 2013 15:30:32 +0200	[thread overview]
Message-ID: <87mwpag41z.fsf@gmail.com> (raw)


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	other threads:[~2013-07-25 13:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 13:30 Thorsten Jolitz [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwpag41z.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.