From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 26531 invoked from network); 30 Apr 2020 16:46:36 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 30 Apr 2020 16:46:36 -0000 Received: (qmail 29613 invoked by alias); 30 Apr 2020 16:46: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: 24816 Received: (qmail 23677 invoked by uid 1010); 30 Apr 2020 16:46:20 -0000 X-Qmail-Scanner-Diagnostics: from relay7-d.mail.gandi.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25793. spamassassin: 3.4.4. Clear:RC:0(217.70.183.200):SA:0(-2.6/5.0):. Processed in 1.835099 secs); 30 Apr 2020 16:46:20 -0000 X-Envelope-From: stephane@chazelas.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _nblcust.gandi.net designates 217.70.183.200 as permitted sender) X-Originating-IP: 94.3.152.49 Date: Thu, 30 Apr 2020 17:45:37 +0100 From: Stephane Chazelas To: Eric Nielsen Cc: "zsh-users@zsh.org" Subject: Re: prefix and join an array Message-ID: <20200430164537.cdex2atmba5fdmnp@chazelas.org> Mail-Followup-To: Eric Nielsen , "zsh-users@zsh.org" References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 2020-04-29 04:22:20 +0000, Eric Nielsen: > > >> % print ${(j., .)${:-DNS:${^list}}} > > > Haa, the secret was in ${name:-word}! > > > Thank you, Bart (: > > I think you can simplify it further to > print ${(j., .):-DNS:${^list}} > right? See also the bash-style ${array/#/prefix} (well you'd also need a [@] in bash): print -r -- ${(j[, ]list/#/DNS:} (also remember "print" like "echo" doesn't do what you want by default, you need -r with print and -E with echo, misdesigns inherited from ksh/PWB. And -- or - to mark the end of options). -- Stephane