From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes From: "Bart Schaefer" Message-Id: <990202033147.ZM3545@candle.brasslantern.com> Date: Tue, 2 Feb 1999 03:31:47 -0800 In-Reply-To: <199902020801.JAA08446@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: Associative array ordering and selective unset (Re: Example function)" (Feb 2, 9:01am) References: <199902020801.JAA08446@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@sunsite.auc.dk Subject: Fun with zsh (Re: Associative array ordering (Re: Example function)) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailing-List: 5175 On Feb 2, 9:01am, Sven Wischnowsky wrote: } Subject: Re: Associative array ordering and selective unset (Re: Example f } } Bart Schaefer wrote: } } > Now change the assignment a little: } > } > map=('*.(gz|Z)' ': 1; zcat } > '*.bz2' ': 2; bzip2 -dc' } > '*.bz' ': 3; bzip -dc' } > '*' ': 4; <') } } Hmm, I like this. For bigger arrays one would have to use `01' and so } on, but this should be acceptible. Somewhat off-topic, but how about this trick? (Where map is a plain array this time.) map=( '(*.(gz|Z)) zcat' '(*.bz2) bzip2 -dc' '(*.bz) bzip -dc' '(*) <' ) eval 'for i do case $i in' ${(j( $i;; ))map} '$i;; esac done' -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com