From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16173 invoked by alias); 1 Jan 2018 08:27:20 -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: List-Unsubscribe: X-Seq: 23044 Received: (qmail 27488 invoked by uid 1010); 1 Jan 2018 08:27:19 -0000 X-Qmail-Scanner-Diagnostics: from mail-it0-f52.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.214.52):SA:0(-1.9/5.0):. Processed in 5.708377 secs); 01 Jan 2018 08:27:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mJ1cuG2NWM8eUfeRsW3wqSMr2Uns0eCSsHI786YsyIQ=; b=pfi1VEKGyCUKkEf8DFF6mI3zZmujWc0Q7iiv+T20II4bF4sSoHcRC0B582HOwJoT5s JoEOIpYKaFvQ+QwhccEQ/lOtboEyFQ7C/70RR8fU5GQcocIUMCdXkT7viZMaVXcPlm8D dRt6Jy7/ELNH2JJQqJtm1RrowCguZctbjW+VZdHjpMi65vUDvvd6ydXSuPxVNOsTr6fn eYreLNVEmDSH/ROUzo4ioy0Ege+lEvMpZ1U/tdK1hvR2u90CIcO5k8es0wVxYpoGXqeH TPCP20EEdk70Z84GJqXvGf/JBc1z+A+aUPm5/0XWhlwSFFYSa0qp4KJeZvNYATah3Yj3 HSsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mJ1cuG2NWM8eUfeRsW3wqSMr2Uns0eCSsHI786YsyIQ=; b=NjwzHsykNZtCvOITy3GG0GoT2m/w8sdqnz8y7SjQqkZ/m/otElTvAvzYYCV3K270g/ jSztsri+4pkm0FmfiIphV2/6kKkEDPp2l+vnpJQYAutE5hKg4xUE1MF0bZOhQWPJG3pw IADGME8tNqOJTP4b1ghD7y5ZuPCFDToVNzpSTc8cCmYjYmCdtFX0riKiBeZnfV4zEEvn 8qj11WbReAyyRNCG8iXgaPjHT9M+ClKzO+sDoC+rRlF6VDNqLaQg4cOK7zHtGnQK+ON1 RvjootEjJYz3RrbI8Q9SGNFDMfEi72Pj0PU4cCbOYXh6MwYbeJ/VK+lotjofPQQ1wtxJ XijQ== X-Gm-Message-State: AKGB3mICeDTfu4gQu4mmHj7ysSO4Ui2T9NlpCcpjqv6by1xYGw0toDcY RgM/3ohqZsAROxwmOmEmZ2NaIw== X-Google-Smtp-Source: ACJfBotQTKYX1RZjsiIqYPnokYaa1/Spp80iVm1lPHRk8AhfQKfhcp4X//DWzresv1XKH9eVkZWVMA== X-Received: by 10.36.250.72 with SMTP id v69mr53291798ith.120.1514795230452; Mon, 01 Jan 2018 00:27:10 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Mix and match parameter expansion flags and sub-scripting flags + quoting From: dana In-Reply-To: Date: Mon, 1 Jan 2018 02:27:08 -0600 Cc: zsh Content-Transfer-Encoding: quoted-printable Message-Id: <428FD648-763F-4B02-9CB7-3E91746261A8@dana.is> References: To: linuxtechguy@gmail.com X-Mailer: Apple Mail (2.3273) On 31 Dec 2017, at 13:01, Jim wrote: >The question, for me, is why two different results, by the same = subscript, >to >apparently the same output from each type of match? In both cases, ${(f)...} is giving you an array. But... >shell=3D${${(M)"${(f)"$(<${TestFile})"}":#*:${UID}:${GID}:*}[(ws/:/)7]} = ; In this case, ${(M)...:#...} is giving you another array consisting of = the members of the first one that match the pattern. Your subscript = [(ws/:/)7] doesn't work, then, because as the documentation says... >w >If the parameter subscripted is a scalar then this flag makes = subscripting work >on words instead of characters. The parameter is *not* a scalar (yet), so it has no effect; it's just = ignored. The subscript then is functionally equivalent to [7], and since there is = no index 7 in the array of matches that gives an empty string. >shell=3D${${"${(f)"$(<${TestFile})"}"[(r)*:${UID}:${GID}:*]}[(ws/:/)7]} = ; In this case, ${...[(r)...]} is returning the first (and only the first) = element that matches the pattern. Since that element is a scalar, the (w) = subscript flag works the way you want. dana