package main
import (
"fmt"
"regexp"
)
var shellQuoteRegex = regexp.MustCompile("([&; \t\n<>|'\"])")
func shellQuote(s string) string {
return shellQuoteRegex.ReplaceAllString(s, "\\$1")
}
func main() {
fmt.Println(shellQuote("ps aux;b"))
fmt.Println(shellQuote("Robert O'Neil \"Album\".png"))
}
To embed this program on your website, copy the following code and paste it into your website's HTML: