ShellQuoteSingle returns a string which is quoted suitably for sh.
(str string)
| 117 | |
| 118 | // ShellQuoteSingle returns a string which is quoted suitably for sh. |
| 119 | func ShellQuoteSingle(str string) string { |
| 120 | // Quote anything that looks slightly complicated. |
| 121 | if shellWordRe.FindStringIndex(str) == nil { |
| 122 | return "'" + strings.Replace(str, "'", "'\\''", -1) + "'" |
| 123 | } |
| 124 | return str |
| 125 | } |
| 126 | |
| 127 | // ShellQuote returns a copied string slice where each element is quoted |
| 128 | // suitably for sh. |
no outgoing calls
no test coverage detected