Function: split-string-shell-command
split-string-shell-command is an autoloaded and byte-compiled function
defined in shell.el.gz.
Signature
(split-string-shell-command STRING)
Documentation
Split STRING (a shell command) into a list of strings.
General shell syntax, like single and double quoting, as well as backslash quoting, is respected.
Other relevant functions are documented in the string group.
Probably introduced at or before Emacs version 28.1.
Shortdoc
;; string
(split-string-shell-command "ls /tmp/'foo bar'")
=> ("ls" "/tmp/foo bar")
Source Code
;; Defined in /usr/src/emacs/lisp/shell.el.gz
;;;###autoload
(defun split-string-shell-command (string)
"Split STRING (a shell command) into a list of strings.
General shell syntax, like single and double quoting, as well as
backslash quoting, is respected."
(with-temp-buffer
(insert string)
(let ((comint-file-name-quote-list shell-file-name-quote-list))
(car (shell--parse-pcomplete-arguments)))))