Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Writing element number into element, of array



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