From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7288 invoked by alias); 3 Jun 2013 15:44:59 -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: 17821 Received: (qmail 3607 invoked from network); 3 Jun 2013 15:44:54 -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 Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=FXuEejzMz8mp5QdTmnhsqk3tUPePg7coH80yqZ+30tw=; b=Gg8TVIMCAbboD1Xi6vY4e85NoY940vm5YdMxJUIjAzu4WMhFZTShL8SNSt4fj3FYqU 8pROQ/XLEkBzpQThStfdZJ1pjo9yJGE61Re/4lrqOzv7Fv5nvikv67BR+sMR+5gjsnh6 vewdA5PoLKzk4slFOShhuHCVuAlUjv+Q34WMqbWnmRw5lKyVc1n2Bt5HK6syLjg5br7L QG3v+VxcoTJ9ui8s6zTzW735PJPyIxKG1KTelu0hOPYbaU3Mn/NH4Bi2mfGF030W4fx3 LRNOpp0cqDUDEGN97qM3CDColQt/SMkNYlfYpZ8d/FgFMcij6hGgSrwamN+8AfJoh2pU g7Kw== MIME-Version: 1.0 X-Received: by 10.66.255.72 with SMTP id ao8mr3182463pad.3.1370274290253; Mon, 03 Jun 2013 08:44:50 -0700 (PDT) In-Reply-To: References: Date: Mon, 3 Jun 2013 08:44:50 -0700 Message-ID: Subject: Re: mapfile, many files and globbin From: Bart Schaefer To: Zsh Users Content-Type: multipart/alternative; boundary=047d7b15b03b50d48904de41d8b3 X-Gm-Message-State: ALoCoQmZmkskycE4jMHYwZX/0EytmbHBwoQwtOFos4nXQYUreGIRDXLW8alV2Fel+gLfhyUmYyhc --047d7b15b03b50d48904de41d8b3 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Jun 3, 2013 at 7:00 AM, Wawrzek Niewodniczanski wrote: > Hi, > > Is it possible to mix mapfile module and globbing (for file names)? > Partly, but not in the way you want. You can mix mapfile and pattern matching but not mapfile and glob flags that reference on-disk file attributes, including recursive directory descent. So in your example: names=("${(f)mapfile[TEST/**/*list(.L+0)]}") > The **/ and (.L+0) won't work. mapfile is just an associative array, so you can only do associative array key matching in the subscript expression. Also, the keys of $mapfile that you can examine are limited to the names of files in the current working directory, and you can't [in a single non-nested parameter expression] expand the contents of a file name matched by a subscript pattern. Similarly ${mapfile[(R)pattern]} will not do a grep for you. However, you can invert the problem and mix globbing with mapfile. names=( TEST/**/*list(.L+0e:'reply=(${(f)mapfile[$REPLY]})':) ) If you don't want the results sorted, you may need some additional flags. --047d7b15b03b50d48904de41d8b3--