(defun string-to-cmd (str) (interactive (list (read-string " $> "))) (let*((cmd (read (car (split-string str " ")))) (args (cdr (make-arg-list (string-to-list str)))) ) (dolist (arg (nreverse args)) (push 13 unread-command-events) ; 13 is RET (dolist (n (reverse (string-to-list arg))) (push n unread-command-events) )) (call-interactively cmd) )) (defun make-arg-list (chars) (interactive) (if chars (let ((WS 39) ; whitespace ( ) (SQM 32) ; quote (') (c (car chars)) (cs (cdr chars)) ) (if (eq c WS) (make-word cs '() WS) (if (eq c SQM) (make-arg-list cs) (make-word chars '() SQM)) )) '() )) (defun make-word (chars wd sep) (interactive) (if chars (let ((c (car chars)) (cs (cdr chars))) (if (eq c sep) (cons wd (make-arg-list cs)) (make-word cs (append wd (list c)) sep))) (list wd) )) (defun zow (string symbol number) "Test: shell-cli.el" (interactive "sstring: \nSsymbol: \nnnumber: ") (message "got: %S" (list string symbol number)) )