#! /command/execlineb -P # Public Domain. # See comments below. # (Search for "HERE".) # = -sCd "\n" lns " ${p} ${bubble} is the end of the quine's data. ${p} They represent the following code, with various quotations: ${p} ${b} (backslash) is represented as ${d}${ob}b${cb} ${p} ${q} (double quote) is represented as ${d}${ob}q${cb} ${p} ${p} (sharp/pound/shibboleth/whatever) is represented as ${d}${ob}p${cb} ${p} ${ob} (open brace) is represented as ${d}${ob}ob${cb} ${p} ${cb} (closed brace) is represented as ${d}${ob}cb${cb} ${p} ${d} (dollar) is represented as ${d}${ob}d${cb} ${p} ${bubble} (the magic word) is represented as ${d}${ob}bubble${cb} ${p} (The point of the magic word is to allow the reader ${p} to conveniently skip over the large data section.) ${p} ${p} Now we have the quine's code! ${p} ${p} First, print the lines that come before the data. ; ${ob} printf %s ${b}${p}${b}!${q} ${q} ${cb} ; ${ob} printf %s${b}${b}n ${q}/command/execlineb -P${q} ${cb} ; ${ob} printf %s${b}${b}n ${b}${p}${q} Public Domain.${q} ${cb} ; ${ob} printf %s${b}${b}n ${b}${p}${q} See comments below.${q} ${cb} ; ${ob} printf %s ${b}${p}${q} (Search for ${q} ${cb} ; ${ob} printf %s${b}${b}n ${b}${q}${bubble}${b}${q}.) ${cb} ; ${ob} printf %s${b}${b}n ${b}${p} ${cb} ; ${ob} printf %s ${q}define -sCd ${b}${q}${b}${b}n${b}${q} lns ${b}${q}${q} ${cb} ${p} Next, print the data themselves, as data. for lin ${ob} ${d}${ob}lns${cb} ${cb} ${ob} multisubstitute ${ob} = b ${d}${ob}b${cb} = q ${d}${ob}q${cb} = p ${d}${ob}p${cb} = ob ${d}${ob}ob${cb} = cb ${d}${ob}cb${cb} = d ${d}${ob}d${cb} = bubble ${d}${ob}bubble${cb} = intron ${d}${ob}intron${cb} ${cb} printf ${b}${b}n%s ${d}${ob}lin${cb} ${cb} ; ${ob} printf %s${b}${b}n ${b}${q} ${cb} ${p} Finally, use the data to print the code! for lin ${ob} ${d}${ob}lns${cb} ${cb} ${ob} multisubstitute ${ob} = b ${b}${b} = q ${b}${q} = p ${b}${p} = ob ${b}${ob} = cb ${b}${cb} = d ${d} = bubble ${bubble} = intron ${q}${intron}${q} ${cb} printf %s${b}${b}n ${d}${ob}lin${cb} ${cb} ${p} That's all, folks! - Well, that wasn't so hard, was it? ${p} (This quine was written by - see ${p} ${p} for more information on quines and how to write them.)" # HERE is the end of the quine's data. # They represent the following code, with various quotations: # \ (backslash) is represented as ${b} # " (double quote) is represented as ${q} # # (sharp/pound/shibboleth/whatever) is represented as ${p} # { (open brace) is represented as ${ob} # } (closed brace) is represented as ${cb} # $ (dollar) is represented as ${d} # HERE (the magic word) is represented as ${bubble} # (The point of the magic word is to allow the reader # to conveniently skip over the large data section.) # # Now we have the quine's code! # # First, print the lines that come before the data. ; { printf %s \#\!" " } ; { printf %s\\n "/command/execlineb -P" } ; { printf %s\\n \#" Public Domain." } ; { printf %s\\n \#" See comments below." } ; { printf %s \#" (Search for " } ; { printf %s\\n \"HERE\".) } ; { printf %s\\n \# } ; { printf %s "= -sCd \"\\n\" lns \"" } # Next, print the data themselves, as data. for lin { ${lns} } { multisubstitute { = b ${b} = q ${q} = p ${p} = ob ${ob} = cb ${cb} = d ${d} = bubble ${bubble} = intron ${intron} } printf \\n%s ${lin} } ; { printf %s\\n \" } # Finally, use the data to print the code! for lin { ${lns} } { multisubstitute { = b \\ = q \" = p \# = ob \{ = cb \} = d $ = bubble HERE = intron "NOTICE HOW THIS SENTENCE APPEARS ONLY ONCE IN THIS QUINE?" } printf %s\\n ${lin} } # That's all, folks! - Well, that wasn't so hard, was it? # (This quine was written by - see # # for more information on quines and how to write them.)