On Wed, Mar 31, 2021 at 09:40:34AM +0200, felix wrote: > As bash read loop could be something slow, I use (when I'm quiet about data > origin) something like: > > declare -A tags="($( > sed -e 's/^\([^|]*\)|\?\(.*\)/[\1]="\2"/' < <( > exiftool ...)) )"
> I'm not absolutely sure about border effect and security issues. I'm absolutely sure that it's terribly unsafe. If there are any double quotes or (command) substitutions in the tag values, this breaks quite hard. I'm also confused about what the \? is supposed to be doing, and whether you're using some kind of crazy GNUism there. It looks like one to me. Please remember that sed is supposed to use BRE, and the equivalent of ERE's ? operator in BRE is \{0,1\} .