I don't have a way to test this MR right now, but I thought I might as well share the code. See below. I've tested it, and it works.
Test case to show the need for this MR:
$ echo '#!/bin/bash' > /bin/foo $ echo 'echo 123' >> /bin/foo $ /bin/foo bash: no such file or directory "foo" (roughly; notice "foo" instead of "/bin/foo")