In the last episode (Jul 30), Peter Stephenson said: > Hrvoje Niksic wrote: > > I suggest modifying the zsh `-x' output to quote its arguments the > > way Bash does. What do the others think? > > This would be nice, but it's not a trivial change. The xtrace output > is done at the last minute after quoting information has been > stripped. This is deliberate, in order to output exactly what is > being evaluated after all substitutions, which is the information you > can't get any other way. This is at odds with showing all the > quotes. It's possible there's some compromise position which would > show a lot of everything --- the quotes get stripped at quite a late > stage. However, there's no way of doing it perfectly without a great > deal of work --- consider expansions like "$@". I think all bash does is check each argument for spaces, single-quotes, or backslashes, and then quotes and escapes that argument. It doesn't care what quoting the user had on the commandline: $ echo one\ two 'one two' "one two" + echo 'one two' 'one two' 'one two' I did a quick hack that replaced a bunch of fprintf/zputs with quotedzputs, and it seems to work fine. It ends up quoting "one'two" as 'one'\''two' for some reason, single-quoting "one", backslash-escaping "'", and single-quoting "two". Weird, but valid. This is my first zsh hack, and I'm probably doing everything wrong, but it shows that it's really not difficult. Even "$@" works. -- Dan Nelson dnelson@allantgroup.com