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

From Esolang
(Redirected from Reverse cat)
Jump to navigation Jump to search
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

^English

Print the source code of this program.

!!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

See also