From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10853 invoked from network); 30 Jul 2002 16:27:29 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 30 Jul 2002 16:27:29 -0000 Received: (qmail 508 invoked by alias); 30 Jul 2002 16:27:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17490 Received: (qmail 494 invoked from network); 30 Jul 2002 16:27:21 -0000 Sender: hniksic@florida.munich.redhat.com To: zsh-workers@sunsite.dk Subject: Quoting in zsh -x output X-Attribution: Hrvoje X-Face: &{dT~)Pu6V<0y?>3p$;@vh\`C7xB~A0T-J%Og)J,@-1%q6Q+, gs<-9M#&`I8cJp2b1{vPE|~+JE+gx;a7%BG{}nY^ehK1"q#rG O,Rn1A_Cy%t]V=Brv7h Date: Tue, 30 Jul 2002 18:26:59 +0200 Message-ID: User-Agent: Gnus/5.090006 (Oort Gnus v0.06) XEmacs/21.4 (Common Lisp, i686-pc-linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Bash has a nice feature of its `-x' output: the arguments that contain whitespace or shell metacharacters are quoted, which allows one to copy the output and paste it into another shell. I find this very useful. Here is an example: bash$ set -x bash$ echo "foo bar" + echo 'foo bar' foo bar bash$ echo "foo*" + echo 'foo*' foo* bash$ echo "foo'bar" + echo 'foo'\''bar' foo'bar bash$ echo "foo" + echo foo foo The last example shows that the quotes are printed only when needed. Arguments containing whitespace and metacharacters are quoted, and embedded single quotes are handled correctly. This makes sure that pasting the output produces the same results. Zsh, on the other hand, prints this: zsh$ set -x zsh$ echo "foo bar" +zsh:2> echo foo bar foo bar zsh$ echo "foo*" +zsh:3> echo foo* foo* zsh$ echo "foo'bar" +zsh:4> echo foo'bar foo'bar zsh$ echo "foo" +zsh:5> echo foo foo I suggest modifying the zsh `-x' output to quote its arguments the way Bash does. What do the others think?