3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

コマンドライン文字列をリストに変換する

Last updated at Posted at 2014-12-05

やりたいこと

(shell-split-string "abc  'def   dee'") => '("abc" "def   dee")

実装

(defun shell-split-string (str)
  "Split string STR into a list of strings by shell."
  (let ((emacs-bin (concat invocation-directory
                           invocation-name)))
    (cdr (read (shell-command-to-string (concat emacs-bin
                                                " -Q --batch --eval '(prin1 command-line-args-left)' -- "
                                                str
                                                " 2>/dev/null"))))))

もっといい方法を募集します。

3
3
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?