Why not to put this at the end of each line? This would make this code much simpler:

```
if ...; then
  STACK+="$src:$linen $func($(IFS=, ; echo "${revarray[*]}"))"$'\n'
fi