Commit e4b3e346e2de5a4f762d93fabbd27869d8d0630a

Thomas de Grivel 2015-09-23T06:33:28

sh-quote accepts str.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/shell/shell.lisp b/shell/shell.lisp
index fcc0c45..605061a 100644
--- a/shell/shell.lisp
+++ b/shell/shell.lisp
@@ -72,10 +72,11 @@ Error: ~S"
 
 ;;  Shell
 
-(defun sh-quote (string)
-  (if (cl-ppcre:scan "^[-+/=.,:^_0-9A-Za-z]*$" string)
-      string
-      (str "\"" (cl-ppcre:regex-replace-all "([$`\\\\\"])" string "\\\\\\1") "\"")))
+(defun sh-quote (&rest str)
+  (let ((str (str str)))
+    (if (cl-ppcre:scan "^[-+/=.,:^_0-9A-Za-z]*$" str)
+        str
+        (str #\" (re-subst "([$`\\\\\"])" "\\\\\\1" str) #\"))))
 
 (defun sh-parse-integer (string)
   (when (< 0 (length string))