use echo instead of printf to avoid % escaping issues (less portable but portable enough)

This commit is contained in:
Michael Vogt
2016-06-03 19:28:19 +02:00
parent 331e1b4636
commit 43072fbf4f
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -48,9 +48,9 @@ func MockCommand(c *check.C, basename, script string) *MockCmd {
logFile := path.Join(binDir, basename+".log")
err := ioutil.WriteFile(exeFile, []byte(fmt.Sprintf(""+
"#!/bin/sh\n"+
"printf \"$(basename \"$0\")\\n\" >> %[1]q\n"+
"echo \"$(basename \"$0\")\" >> %[1]q\n"+
"for arg in \"$@\"; do\n"+
" printf -- \"$arg\\n\" >> %[1]q\n"+
" echo \"$arg\" >> %[1]q\n"+
"done\n"+
"printf \"\\n\" >> %[1]q\n"+
"%s\n", logFile, script)), 0700)