From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19228 invoked by alias); 13 Apr 2017 21:03:41 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40971 Received: (qmail 25958 invoked from network); 13 Apr 2017 21:03:41 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f179.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.217.179):SA:0(-0.0/5.0):. Processed in 1.297054 secs); 13 Apr 2017 21:03:41 -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=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.179 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=1oIpWtzUuJdNdKH8W4gNrN8xycd2BoW/l4rb+9wfndA=; b=cbGThHUCCLbgOv9aqsdOF9pTsvJE3LDD/VBCV0Rms28RqXMBDp1x0DLn6Qr7Mvmzse 8fqvoSKvS61zQPsDh4BFVXu3L7WAviCL3TGaUrutcW2esLqV7ebyukUqSUrqFQVr00Yv QhX7aqo+58DRdN3+mhpX8c7yEXnZo5GnxeWjpqNhp6Ok3CJkp1sXOiY6wGJ23ZhH1Ocp l0qtGMh5f6Jfi0KhYb/06t+ByfPB5vUDrueqEEPryRakOGOhqTui0gTcEspCFmXuK8uD WwTkLUgoMFiICLZUUNjqu8x0HaVKRWeYhsl+Qqbh1pfEnKIR1kMj7uz148z2YMWFe5ic vn2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=1oIpWtzUuJdNdKH8W4gNrN8xycd2BoW/l4rb+9wfndA=; b=Zjwcu9SuEiw5JWDZKfup6ch2f9Hn5+pCWcxNMwpjMm/tjaXmSqhqEQPDLIqaR4sst5 bBTyqpqgvT6u5pEJPojMvrP4c0Nf0KeKhEZYOsFLf8+DOxdQaKcujxCXaHTQ63SWsZHv NNyzyNB70rTmZQTbldBr6v2i+Xr3VMFfwXlI5CGtV89qKTdFnj8Hc5fKgcyRcjZZvfSu TMqpCzJXh2aUc2RIUZVrOwrDyzye0MSyYgEqbYrd2leBkrKmZRMJljNM6FZneiJkfOn/ urtRcaSPuqbTOno43WmJfmbqMzQ4yJttQK+mPYH13GGCODDybqDg0RQZEPAWN/eyKE9O lQLA== X-Gm-Message-State: AN3rC/55DH1gpdzl0O0a7GGr/P5+bdx/DpYPcZ9DY1oh8eEFfN8fbohQ i+9XHohbdNxbM0ti X-Received: by 10.176.91.85 with SMTP id v21mr2588499uae.133.1492117409279; Thu, 13 Apr 2017 14:03:29 -0700 (PDT) From: Bart Schaefer Message-Id: <170413140353.ZM11819@torch.brasslantern.com> Date: Thu, 13 Apr 2017 14:03:53 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: [PATCH] Forcing array interpretation in parameter substitution" (Apr 13, 6:29pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [PATCH] Forcing array interpretation in parameter substitution MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 13, 6:29pm, Sebastian Gniazdowski wrote: } } Just realized that this isn't a "5.0.2" or so thing. } } I wonder if there can be any workaround for older versions This is sort of ugly, because (z) itself is failing to return an array when the string to be split has only one word. The workaround described in users/22497 does the right thing for (s::) but not for (z). For (z) you need to force array-ness by splitting some other way and then also add (z). E.g.: var="abc"; echo ${${(Afz)reply::=$var}[1]} Of course if there are embedded newlines that are quoted, (f) will break them incorrectly, so you need something more like echo ${${(Aps:\0:z)reply::=$var}[1]} Which still breaks if you have embedded NUL bytes in $var, but ...