The xtrace (set -x) output in dash is a bit of a pain, because arguments containing whitespace aren't quoted. This can it impossible to tell which bit belongs to which argument: $ dash -c 'set -x; printf "%s\n" one "two three" four' + printf %s\n one two three four one two three four Another disadvantage is you cannot simply copy and paste the commands from this xtrace output to repeat them for debugging purposes. I wrote the attached patch which fixes this. I've been testing it for about a week and had no issues. The patch changes the following: - Since we don't want every command name and argument quoted but only those containing non-shell-safe characters, single_quote() has acquired an extra argument indicating whether quoting should be conditional upon the string containing non-shell-safe characters (1) or unconditional (0). Shell-safe characters are defined as this set: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%+,./:=@_^!- - Quoting of variable assignments preceding commands needs to be handled specially; in order for the output to be suitable for re-entry into the shell, only the part after the "=" must be quoted. For this purpose, I changed eprintlist() into two functions, eprintvarlist() to print the variable assignments and eprintarglist() to print the rest. Hope this is useful, - Martijn