The command to recalculate the md5 is wrong. The result needs to be in double quotes. Command in question.
f=poap.py ; cat $f | sed '/^#md5sum/d' > $f.md5 ; sed -i "s/^#md5sum=./#md5sum=$(md5sum $f.md5 | sed 's/ .//')/" $f
Correct command
f=poap.py ; cat $f | sed '/^#md5sum/d' > $f.md5 ; sed -i "s/^#md5sum=./#md5sum="$(md5sum $f.md5 | sed 's/ .//')"/" $f
The command to recalculate the md5 is wrong. The result needs to be in double quotes. Command in question.
f=poap.py ; cat $f | sed '/^#md5sum/d' > $f.md5 ; sed -i "s/^#md5sum=./#md5sum=$(md5sum $f.md5 | sed 's/ .//')/" $f
Correct command
f=poap.py ; cat $f | sed '/^#md5sum/d' > $f.md5 ; sed -i "s/^#md5sum=./#md5sum="$(md5sum $f.md5 | sed 's/ .//')"/" $f