From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12769 invoked by alias); 22 Sep 2011 08:32:47 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16394 Received: (qmail 19869 invoked from network); 22 Sep 2011 08:32:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 74.125.82.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=G2VBkcPSwmGOpREUpCfPVFNth8l6wLnWjd+2k7y+hk0=; b=STxS6JnyxKtri11C0/FTizmvCRI3DXWTxFQF6VAbf4xqT/pVBCBqeFH9LDxnGs4Dtc Gsa7IQ/+ifzb+2nwOvtpd9GRRM9+5i0zuVUQRohDhZ1QKluQmMntQK8aX6gngCiPAxsj DWKrZQ7tFQCno1S5URNUtBE7o+1SezmSx7fWM= MIME-Version: 1.0 In-Reply-To: References: From: =?UTF-8?B?SsOpcsOpbWllIFJvcXVldA==?= Date: Thu, 22 Sep 2011 10:32:18 +0200 Message-ID: Subject: Re: using parameter expansion sorting flags To: Zsh Users Cc: Rory Mulvaney Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Rory, 2011/9/22 Rory Mulvaney : > I have a few filenames that I put into an array with: > > PNMFILES=3D( f.*.{Atop,Bbot}.pnm ) > > the ordered contents of this array become: > > f.0009.Atop.pnm f.0010.Atop.pnm f.0011.Atop.pnm f.0012.Atop.pnm > f.0009.Bbot.pnm f.0010.Bbot.pnm f.0011.Bbot.pnm That's because you're mixing braces and globbing. What happens first is: f.*.{Atop,Bbot}.pnm =E2=86=92 f.*.Atop.pnm f.*.Btop.pnm then only globbing is performed. You could have used globbing only, and the =E2=80=9Co=E2=80=9D flag to have= a sorted array in the first place: PNMFILES=3D( f.*.(Atop|Bbot).pnm(on) ) > Now I can't figure out how to order them in an array, using the parameter > expansion sorting flags n and o, as: > > f.0009.Atop.pnm f.0009.Bbot.pnm f.0010.Atop.pnm f.0010.Bbot.pnm > f.0011.Atop.pnm f.0011.Bbot.pnm f.0012.Atop.pnm > Also I'd like the resulting resorted array PNMFILES2 to be such that: > > echo ${PNMFILES2[2]} > > yields: > > f.0009.Bbot.pnm > > rather than some single character. PNMFILES2=3D${(on)PNMFILES} Best regards, --=20 J=C3=A9r=C3=A9mie