The assignment of a new value generated in a subshell does work without the trailing comment:
newname=$(echo "$newname" | sed 's@TD.'"$oldnewTD"'@TD.r'"$ftd1"'@')
But the variable newname stays unchanged if a trailing comment is added:
newname=$(echo "$newname" | sed 's@TD.'"$oldnewTD"'@TD.r'"$ftd1"'@')# let us not change NonEqRead to NonEq
Why?
Bash version 5.0.3.