From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10023 invoked from network); 6 Sep 2003 21:18:09 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 6 Sep 2003 21:18:09 -0000 Received: (qmail 5324 invoked by alias); 6 Sep 2003 21:18:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19036 Received: (qmail 5314 invoked from network); 6 Sep 2003 21:18:03 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 6 Sep 2003 21:18:03 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [217.174.194.138] by sunsite.dk (MessageWall 1.0.8) with SMTP; 6 Sep 2003 21:18:2 -0000 Received: from DervishD.pleyades.net (212.Red-80-35-44.pooles.rima-tde.net [80.35.44.212]) by madrid10.amenworld.com (8.10.2/8.10.2) with ESMTP id h86LHp400798; Sat, 6 Sep 2003 23:17:51 +0200 Received: from raul@pleyades.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <19vkU7-00009i-00>; Sat, 6 Sep 2003 23:20:43 +0200 Date: Sat, 6 Sep 2003 23:20:43 +0200 From: DervishD To: Wayne Davison Cc: Zsh Subject: Re: Little doubt about an expansion flag Message-ID: <20030906212043.GD175@DervishD> Mail-Followup-To: Wayne Davison , Zsh References: <20030906194319.GA175@DervishD> <20030906203647.GE24100@binome.blorf.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20030906203647.GE24100@binome.blorf.net> User-Agent: Mutt/1.4i Organization: Pleyades User-Agent: Mutt/1.4i Hi Wayne :) * Wayne Davison dixit: > > and I'm looking (deciphering is more appropriate) at the first > > part, namely ${(f)"$(ps xh)"}. When doing this, the output of the ps > > command is *joined*, deleting the \n characters!!! > Nope, the \n characters are not deleted because of the double quotes. Not exactly in this case... The problem was the 'echo' command I was using. With 'print -l', which outputs *elements* separated by whitespace, I can see that the (f) modifier is splitting the output of the ps command into the lines and not into the spaces, so we can do the matching on complete lines. Now I understand it, thanks to print -l :))) > Try this: > echo "$(ps xh)" > You'll see that they are still there. But the (f) modifier strips then and do splitting on them, and not in words... When using echo I was using double quotes. I mean, when doing the command (ps or whatever), let's have 'foo bar\nfoo2 bar2\nlastline' as output. Well, then we have: $echo $(command) foo bar foo2 bar2 lastline $echo "$(command)" foo bar foo2 bar2 lastline $echo "${(f)"$(command"}" foo bar foo2 bar2 lastline $print -l "${(f)"$(command"}" foo bar foo2 foo2 lastline What I didn't understand was the last 'echo' command, before the 'print -l' one. That's because echo has no idea about elements and the like, print has. Now I understand all this. I should get used to employ 'print' instead of 'echo', definitely ;))) > > Finally, I would like to know how the shell manages to parse > > this: "${(f)"$(ps xh)"}", because it seems that the shell can read my > > mind and parses the quotes nested, and not like "${(f)" $(ps xh) "}". > Yes, this happens inside ${...} -- quotes start over in their nesting. OK, gotcha, thanks a lot for explaining :) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/