Your problem is not in the cycle, but in the task. The variable name must be literal in the task, i.e. You can write title=some_value, but not $arg=some_value.
eval. $arg ( arg, $arg), eval.
new_value="$(eval printf %s \"\$$arg\" | …)"
eval $arg=\$new_value
, bash/ksh/zsh, - typeset. bash, , . , ${!arg}; bash.
typeset $arg="$(printf %s "${!arg}" | …)"
:
title="$(echo string1)" - title="string1", , , string1, -.do (; ).
bash/ksh/zsh, ${VARIABLE//PATTERN/REPLACEMENT}.
title="string1"
artist="string2"
album="string3"
for arg in title artist album; do
eval value=\$$arg
value=${value
value=${value
value=${value
eval $arg=\$value
done