Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Writing element number into element, of array
- X-seq: zsh-users 22545
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <psprint3@xxxxxxxxxxxx>
- Subject: Re: Writing element number into element, of array
- Date: Mon, 6 Mar 2017 16:21:08 +0000
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=yxnnVaf33EFPvxY23Ak2kspBRBk=; b=h61ZXh7LxjqX7ywv89gxo N0Pkq2mookqHu+Q90JDdMIOjrjhZMSRYJFRdM3EL54drMHP1vmrxiRsFmd+86CG/ QuHsIrVN0wfz7BNy9XabkbtP6VKPABmlTd7ezBrF6p11HpXQpnUd27sjToqevWp3 JVnCEkvF6xfwaLXbbf0tBY=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=yxnnVaf33EFPvxY23Ak2kspBRBk=; b=aYxn0o/36iimrbzyoJzt euQDl9sosx9StttqE0pH86ZYQz7DDJa50mI3DsDcBGMG8cuZnQ6ETvE8dHa2DixP JBZywMt/xWuiwpgNtXu5FexCde6SQz7LNI/VbJEdt/PnJEFWBzwkkB8sLOvFLF3x pqMmFydPwHHkppfbMpyVuAA=
- In-reply-to: <1488812858.3917137.901986216.79381701@webmail.messagingengine.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author