zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Sebastian Gniazdowski <psprint3@fastmail.com>
Cc: zsh-users@zsh.org
Subject: Re: Writing element number into element, of array
Date: Mon, 6 Mar 2017 16:21:08 +0000	[thread overview]
Message-ID: <20170306162108.GA5574@fujitsu.shahaf.local2> (raw)
In-Reply-To: <1488812858.3917137.901986216.79381701@webmail.messagingengine.com>

Sebastian Gniazdowski wrote on Mon, Mar 06, 2017 at 07:07:38 -0800:
> # echo ${arr[@]//(#b)(((*)-LINE-(*))|(*))/$match[3]$(( mend[2] != -1 ?  ++ line : ( ++line, 0 ) ))$match[4]$match[5]}

You could probably slap a ${foo:/0/} around the $((…)) (see
${name:/pattern/repl} in zshexpn(1)), but personally, I wouldn't write
it as a one-liner in the first place, for readability.


      reply	other threads:[~2017-03-06 16:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 15:07 Sebastian Gniazdowski
2017-03-06 16:21 ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170306162108.GA5574@fujitsu.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=psprint3@fastmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).