From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13709 invoked by alias); 31 Oct 2014 01:57:06 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33580 Received: (qmail 22791 invoked from network); 31 Oct 2014 01:56:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 MIME-version: 1.0 Content-type: multipart/alternative; boundary="Boundary_(ID_zHOmkZcYyyYkPXSASk7kZA)" X-Authority-Analysis: v=2.1 cv=AduIQRnG c=1 sm=1 tr=0 a=uer5AyTGRFuXjkAQo2VXJA==:117 a=uer5AyTGRFuXjkAQo2VXJA==:17 a=gmhVCtT3eHoA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=9iDbn-4jx3cA:10 a=cKsnjEOsciEA:10 a=jZD8QeV6rbhBArA-VQ4A:9 a=pILNOxqGKmIA:10 a=q2GGsy2AAAAA:8 a=KXWTESEwE2XRFlVnBT0A:9 a=24e8D3VYeBCVIl8f:21 a=_W_S_7VecoQA:10 Message-id: <5452ED18.7070208@eastlink.ca> Date: Thu, 30 Oct 2014 18:59:52 -0700 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.1.2 To: zsh-workers@zsh.org Subject: Re: first adventures References: <544D2D6F.8030505@eastlink.ca> <20141026175257.2611487b@pws-pc.ntlworld.com> <544FD6DD.7010806@eastlink.ca> <141028210510.ZM10784@torch.brasslantern.com> <54510A96.20009@eastlink.ca> <141029134624.ZM15681@torch.brasslantern.com> <545178DF.1040600@eastlink.ca> <141029210738.ZM15833@torch.brasslantern.com> In-reply-to: <141029210738.ZM15833@torch.brasslantern.com> --Boundary_(ID_zHOmkZcYyyYkPXSASk7kZA) Content-type: text/plain; CHARSET=US-ASCII; format=flowed Content-transfer-encoding: 7BIT On 10/29/2014 09:07 PM, Bart Schaefer wrote: > On Oct 29, 4:31pm, Ray Andrews wrote: I believe you have done it, sir: #!/usr/bin/zsh typeset -g TLC TRAPDEBUG() { # This works perfectly to print directly to screen: #(( $#functrace == 1 )) && print -u2 "$ZSH_DEBUG_CMD" # Top Level Command capture: (( $#functrace == 1 )) && TLC="${ZSH_DEBUG_CMD}" } test() { # We only want the arguments so chop off the command itself: chop_cmd=${TLC/$0/} echo print -ru2 "My unexpanded arguments were: $chop_cmd" print -u2 "\n...and my arguments broken to an array:\n" array=("${=chop_cmd}") print -ru2 "two: $array[2]" print -ru2 "three: $array[3]" print -ru2 "four: $array[4]" print -ru2 "five: $array[5]" print -ru2 "six: $array[6]" } It is proof against glob or variable expansion, it swallows redirection, and it doesn't mind compound command lines, however it does expand bangchar, as wanted: $ test ls $PWD; test ls g* > /dev/null; test l ,H $PWD/test; test 'I wandered \n lonely as a cloud'; test "that \n floats on high" My unexpanded arguments were: ls $PWD ...and my arguments broken to an array: two: ls three: $PWD four: five: six: My unexpanded arguments were: ls g* > /dev/null ...and my arguments broken to an array: two: ls three: g* four: > five: /dev/null six: My unexpanded arguments were: l ,H $PWD/test ...and my arguments broken to an array: two: l three: ,H four: $PWD/test five: six: My unexpanded arguments were: 'I wandered \n lonely as a cloud' ...and my arguments broken to an array: two: 'I three: wandered four: \n five: lonely six: as My unexpanded arguments were: "that \n floats on high" ...and my arguments broken to an array: two: "that three: \n four: floats five: on six: high" ... I think I can't even quibble about the quoted strings not being treated as single arguments because I can't have it both ways--the whole exercise is to have zero processing. And I don't even need to rape the src. --Boundary_(ID_zHOmkZcYyyYkPXSASk7kZA)--