Let's say we need to pass some argument to the shell command. (Assume a Bourne-compatible shell.)
For example, let's say we want to print a string He said "It a boy"; sureusing echo (1).
Naturally, we cannot do this as follows:
s = [[He said "It a boy"; sure]]
os.execute("echo " .. s)
But the following works just fine:
s = [[He said "It a boy"; sure]]
os.execute(("echo %q"):format(s))
My question is: Do you think using% q to quote shell arguments is good enough?
I already know that it is %qnot very good if our argument includes a new line (it will be converted to slash + newline, which would mean that the shell will not see any character, but at least it will not break the command). So one case is against us. Are there other cases where %qwe will not fail?