2011-09-09
Quines are self-printing programs. Here’s one for fun in awk (gnu awk).
BEGIN{S="BEGIN{S=\"%s\";s=S;gsub(/\\\\/,\"\\\\\\\\\",s);gsub(/\\\"/,\"\\\\\\\"\",s);printf(S,s)}";s=S;gsub(/\\/,"\\\\",s);gsub(/\"/,"\\\"",s);printf(S,s)}
awk -f quine_gawk.awk 2>/dev/null | diff quine_gawk.awk -
Related tags:
email comments to paul@bauer.codes