H9+ : 1 char
That's right. One character. Outputs the lyrics to 99 bottles of beer, which is a valid program. All the extraneous data does not count, but there are plenty of 9s in there.
The output of the outputted program is the lyrics to 99 bottles of beer 59 times.
This function gives the number of times the lyrics are outputted if you run the ...
GolfScript, 9 chars
This code outputs:
and so on.
I believe this is the shortest answer in a "real" Turing-complete programming language so far.
Basically, the original code above is a "quine-layer": it outputs a normal ...
Ed (1 byte)
All the other solutions thus far are long and ugly. I suppose that is because of the nature of most error messages. But a good error message is elegant in its simplicity. For that, look no further than ed.
Save this to a file called edscript and run with ed < edscript, or run ed<<<?. The result:
The question mark is written ...
Java 7: 0 chars
Save as file Blank.java. If you save it as any other file, replace any instance of Blank with the appropriate file name.
Then, run in command line via first compiling, then running. If compiling fails, stop.
I list this as Java 7 because it might output differently for different versions of Java.
First few outputs (outputted to stderr):
huh?, 5 characters
I actually have NO idea how it works, but If you download the interpreter, and if you write !hcuO, then you get Ouch!
To run this, you need to execute the program like this:
It will actually look for a file called !hcuO, but it doesn't exist, so it outputs Ouch!
CoffeeScript, syntactically valid
As tested on their website using Chrome or Firefox.
ReferenceError: defined is not defined
You can replace defined with anything that's not a built-in variable, but I thought this version was fun. Unfortunately, undefined is not defined in particular doesn't work as a quine.
In CoffeeScript this isn't even a syntax error,...
CJam, 4X4 (12 10 non-spaces)
Previous version with 12 non-spaces:
And the output is
As pointed out by Martin, this version has
4 other characters, and
4 4 as the output
Try it online here
GolfScript - 2
(ie \n1 where \n is the newline character)
To quote Ilmari:
GolfScript automatically appends a newline to the end of the output
Thus a newline followed by a number will print the number followed by a newline.
Prelude, 5157 4514 2348 1761 1537 664 569 535 423 241 214 184 178 175 169 148 142 136 133 bytes
Thanks to Sp3000 for saving 3 bytes.
This is rather long... (okay, it's still long ... at least it's beating the shortest known Brainfuck C# quine on this challenge now) but it's the first quine I discovered myself (my Lua and Julia submissions are really just ...
Zsh, 4 bytes
The Z shell has feline functionalities built in. The fourth character is a linefeed.
Try it online!
The code does not depend in any way on the file name; it works even if the file name contains special character, such as spaces or newlines.
$ cat "my quine.sh"
$ zsh "my quine.sh"
$ diff -s <(zsh "my quine....
><>, 25 words + (22 + 11 + 11) extra = 57 49
Oh god, my brain.
'brr3deep*clap6beep+orb5flap*leap4deep+clap5beep5flap*leap9deep9clap*beep+flap0placed apple alp0leap=clip?lob8blip*flip0clip.
Since the rules state "There is no input.", for this program to work you'll need to pipe in an empty file.
Oh and yes, brr is a valid Scrabble word, as are tsktsk ...
Well, a rather trivial solution for the Spyder IDE is to raise a SyntaxError.
Code and identical output:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 540, in runfile
Marbelous - 16x16
Test it here! Spaces as blanks, cylindrical board, and include libraries all must be checked.
Vim, 11 bytes
iq"qP<Esc>: Manually insert a duplicate of the text that has to be outside the recording.
q" and hqP: Record the inside directly into the unnamed "" register, so it can be pasted in the middle. The h is the only repositioning required; if you put it inside the macro, it will be pasted into the result.
A note ...
Cubix, 20 bytes
Almost got the \o/...
Q u $ v @ ! < "
O O w \ o ; / "
Try it online
Try it here!
After being impressed by reading this great answer by @ais523, I started thinking about further golfing the quine. After all, there were quite a few no-ops ...