The next step is basically a quine with a template of diff cruft around it. It has to output this, where N is the number of lines in the program:
1,Nc1,3
< HERE IT REPRODUCES
< ITS OWN N-LINE IMAGE
< ...
---
> #!/bin/sh
> head -n2 $0 | diff - /dev/null
> exit 0
Since "quining" via $0 is evidently fair game, that simplifies things a lot. Here you go: #!/bin/sh
sed -e 's/^X//' <<!
X1,9c1,3
$(sed -e s'/^/< /' $0)
X---
X> #!/bin/sh
X> head -n2 \$0 | diff - /dev/null
X> exit 0
!
On first try, I didn't escape the dollar sigil on $0, so that got expanded to ./x3.sh, resulting in a minor difference. But since we are not doing any true quining, all I had to do was add the backslash without having to rack my brain on how to compensate for that character elsewhere; the "reproduce self accurately" requirement is trivially taken care of with $0.With the above template, you can diff back to any body of text, so it can be easily continued.