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

Re: modify or delete variable



On Sat, Apr 6, 2024, at 10:57 AM, Ray Andrews wrote:
>     var=( ${(M)var:#*(#i)$substring*} )
>     var=( ${var//(#bi)($substring)/aaa${match[1]}bbb )
>
> ... can those to operations be combined?  If a string exists in a 
> variable, modify it, else delete it?

var=(${${(M)var:#*(#i)$substring*}//(#bi)($substring)/aaa${match[1]}bbb})

-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author