We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Cat program
- Not to be confused with Cat Program (language), nor Cat (Language).
- For the concatenative language, see catlangwiki:Cat.
The cat program is a program that copies its standard input to its standard output. It is named after the Unix command cat, although this command is actually more powerful. The cat program is a popular problem.
cat has also been described humorously as a programming language in which every program is a quine. The programming language is obviously of very limited computational usefulness. See HQ9+ and Text.
Hello world and quine program
#!/usr/bin/cat Hello, world!
You must chmod +x the program file to make it executable:
$ chmod +x file
To execute it:
$ ./file
(assuming file is the filename of the program)
Reverse cat
Other shell commands could be used in similar way, so there is reverse variant of cat language too. Unix command line utilities in this space include both rev (reversing characters within each line) and tac (reversing the order of lines in the input; cat backwards).
$ echo '!dlrow ,olleH' | rev Hello, world!
$ (echo 'world!'; echo 'Hello,') | tac Hello, world!
$ (echo '!dlrow'; echo ',olleH') | tac | rev # or ... | rev | tac Hello, world!
A simple "reverse cat" program could simply output the bytes of the input backwards, which for a conventional newline-delimited text file has roughly the effect of rev and tac combined (except for the treatment of the file's trailing newline).
While a regular cat program requires only O(1) storage space, a reverse cat program requires O(n) storage space, so as a popular problem it is a slightly more ambitious achievement.
Implementations
綠酒千杯腸已爛
與君六千七百九十八杯酒。可以窮歡宴。綠酒一杯歌一遍。 與君六千七百九十七杯酒。可以窮歡宴。綠酒一杯歌一遍。 …… 與君三杯酒。可以窮歡宴。綠酒一杯歌一遍。 與君二杯酒。可以窮歡宴。綠酒一杯歌一遍。 與君一杯酒。可以窮歡宴。綠酒一杯歌一遍。 綠酒千杯腸已爛。
‰
i.
^English
Print the user’s input.
!!brainfeed
^.
... Bottles of beer on the wall
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. bottles of beer on the wall, .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. bottles of beer. Take one down and pass it around, ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. bottles of beer on the wall. …… (a lot of characters ommited) ... bottles of beer on the wall, ... bottles of beer. Take one down and pass it around, .. bottles of beer on the wall. .. bottles of beer on the wall, .. bottles of beer. Take one down and pass it around, . bottle of beer on the wall. . bottle of beer on the wall, . bottle of beer. Take one down and pass it around, no bottles of beer on the wall. No bottles of beer on the wall, no bottles of beer. Go to the store and buy some more, .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. bottles of beer on the wall.
Assemble
$st "" ipt st dvr st pas brk
brainfuck
,[.,]
Befunge
~,
C
This program takes in a user input and prints it, then takes in another user input and prints it, and so on...
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
FILE *fp;
void filecopy(FILE *, FILE *);
if (argc == 1) {
filecopy(stdin, stdout);
}
else {
while (--argc > 0) {
if ((fp = fopen(*++argv, "r")) == NULL) {
printf("cat: Can't open file '%s'", *argv);
return 1;
} else {
filecopy(fp, stdout);
fclose(fp);
}
}
}
return 0;
}
void filecopy(FILE *ifp, FILE *ofp) {
int c;
while ((c = getc(ifp)) != EOF) {
putc(c, ofp);
}
}
Dotfuck
.................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ................................................
brainfuck
,[.,]
Deadfish+
ofjpog
Español
Leer la pagina en esta wiki sobre "Cat program" Este programa simula ese programa.
ExampleFuck
Hello World FizzBuzz Polyglot Self Interpreter 99 Bottles of Beer
Fish Code
<,.{0}><
Pepe
REEe Reee
Python
print(input())
RAGE!!!
<rant> WHY DOES K MEAN THE SAME THING AS WHAT YOU'RE ABOUT TO TELL ME SCREAM K!!! </rant>
Regards,
Reads until the end of input, one character at a time.
Subject: Fwd: Fwd: Fwd: FW: read this Hi all, FYI, forwarding this exactly as I received it. Just to level-set, letter is 0. Reading between the lines. Per my last email, while we're over -1 on letter: > Let me spell it out. > Reading between the lines. Best, Ihor
Simpl
print(usrinp())
SpoilerFuck
,.,
Truths-machine
truths(i, o=i out(o))
Tol
toltoLToLTOlTOL
Unary (compressed)
56623
Zidryx myno
dfwbh(wbdih())