Adjust shell quoting
Alpine 3.19 Success
Details
Alpine 3.19 Success
Details
This commit is contained in:
parent
b594ff78b2
commit
4a23c47a92
2
acid.go
2
acid.go
|
@ -102,7 +102,7 @@ var shellFuncs = ttemplate.FuncMap{
|
||||||
"quote": func(word string) string {
|
"quote": func(word string) string {
|
||||||
// History expansion is annoying, don't let it cut us.
|
// History expansion is annoying, don't let it cut us.
|
||||||
if strings.IndexRune(word, '!') >= 0 {
|
if strings.IndexRune(word, '!') >= 0 {
|
||||||
return "'" + strings.ReplaceAll(word, "'", `'"'"'`) + "'"
|
return "'" + strings.ReplaceAll(word, "'", `'\''`) + "'"
|
||||||
}
|
}
|
||||||
|
|
||||||
const special = "$`\"\\"
|
const special = "$`\"\\"
|
||||||
|
|
|
@ -12,7 +12,7 @@ func TestTemplateQuote(t *testing.T) {
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
input, output string
|
input, output string
|
||||||
}{
|
}{
|
||||||
{`!!`, `'!!'`},
|
{`!!'!$`, `'!!'\''!$'`},
|
||||||
{``, `""`},
|
{``, `""`},
|
||||||
{`${var}`, `"\${var}"`},
|
{`${var}`, `"\${var}"`},
|
||||||
{"`cat`", "\"\\`cat\\`\""},
|
{"`cat`", "\"\\`cat\\`\""},
|
||||||
|
|
Loading…
Reference in New Issue