Can we write the shell script out using `Pathname.write` instead? Will make the patch a bit more manageable.