Narcissistic Quine

Python 3.8 (pre-release), 67 60 56 bytes

exec(a:='print(s:=input())\nwhile s!="exec(a:=%r)"%a:1')

Try it online!


Python 2, 56 bytes

a='s=input();print s\nwhile s!="a=%r;exec a"%a:1';exec a

Try it online!


GolfScript, 20 bytes

{`".~"+{.2$=}do\;}.~

Try it online!

Explanation

{                }.~ # Evaluate the following string as GolfScript code, using the string itself as argument:
 `                   # - Uneval (effectively wrap the string in ""
  ".~"+              # - Append .~
       {.2$=}do      # - Do While not equal to the original program argument:
                     #   - (Basically do nothing)
               \;    # - If this loop ends, discard the extra copy of the input

Jelly, 14 bytes

“Ṿ;⁾v`¹⁻³$¿”v`

Try it online!

A program taking a single string argument and either printing its source if the string matches its source, or looping indefinitely if not.

Explanation

“          ”v` | Evaluate the following string as Jelly code, using the string itself as argument:
 Ṿ             | - Uneval (effectively wrap the string in “”
  ;⁾v`         | - Append v`
       ⁻³$¿    | - While not equal to the original program argument:
      ¹        |   - Call the identity function