Cat program

From Esolang
Jump to: navigation, search

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[edit]

#!/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[edit]

Other shell commands could be used in similar way, so there is reverse variant of cat language too. It's called rev:

#!/usr/bin/rev
!dlrow ,olleH