Menu

quines

quine in awk

Quines are self-printing programs. Here’s one for fun in awk (gnu awk). source quine_gawk.awk BEGIN{S="BEGIN{S=\"%s\";s=S;gsub(/\\\\/,\"\\\\\\\\\",s);gsub(/\\\"/,\"\\\\\\\"\",s);printf(S,s)}";s=S;gsub(/\\/,"\\\\",s);gsub(/\"/,"\\\"",s);printf(S,s)} usage awk -f quine_gawk.awk 2>/dev/null | diff quine_gawk.awk - quine in awk full article

site menu

Back to top