3 ms·
``` #!/bin/bash cat $0 ```
by darkwater 5y ago
```
#!/bin/bash
cat $0
```
- susam 5y agoOr as was posted to https://news.ycombinator.com/item?id=29874052 https://news.ycombinator.com/item?id=29874052 by @jcalvinowens a few hours ago, we can also simplify this to just: #!/bin/cat Example: $ echo '#!/bin/cat' > foo $ chmod +x foo $ cat foo #!/bin/cat $ ./foo #!/bin/cat
- charcircuit 5y agoor just an empty string for various languages
- capableweb 5y agoSeems like that would only work for languages where the last returned value is printed as-is when running it. Other languages wouldn't print `""` but have no output instead.
- drdeca 5y agoI think they meant that the program would be 0 bytes long, not two characters which are both quotation marks
- capableweb 5y agoAh, I see. Funny lateral thinking exercise I guess, not so interesting in terms of actually creating a Quine :)
- capableweb 5y agoWouldn't this be considered cheating according to the submission? > The easiest way to do that, of course, is to seek the source file on the disk, open it, and print its contents. That may be done, but it is considered cheating; besides, the program might not know where the source file is, it may have access to only the compiled data, or the programming language may simply forbid that sort of operations.