Op 28-02-17 om 00:17 schreef Martijn Dekker: > Op 27-02-17 om 21:08 schreef Martijn Dekker: >> Shell reserved words (a.k.a. shell keywords) such as "if" are harder to >> fix. The single_quote() routine, if told to quote conditionally, would >> have to iterate through the internal list of shell reserved words and >> quote the string if it matches one of those. I will see if I can make >> that happen. > > Here is a version that does that, and removes '=' and '!' from the list > of shell-safe characters. This should fix all the issues you were > reporting, hopefully making the xtrace output completely safe for shell > re-entry. It introduces a new function is_kwd() that checks if a string > is identical to a shell keyword/reserved word. > > Attached are two patches: one incremental to my previous one, and one > against pristine dash 0.5.9.1. There's a bug in my code. Empties need to be quoted, or they'll disappear. A simple check for the first character being null fixes it. Once again, one incremental patch against v2, one against pristine dash 0.5.9.1. - M.