Unix shell commands
As Unix and Linux allows a user to write a script that uses any program available in a system as interpreter the set of these commands becomes a kind of programming language.
Avoiding the obvious interpreters (awk, sh, perl, python, ruby ...) the most obvious case is a cat, a programming language which produces only Quines, but in fact there are a lot more examples, including:
Language | Features | Examples |
---|---|---|
cat | Every program is a Quine |
Hello World and Quine: #!/bin/cat Hello, World! |
rev | Reverse variant of cat language |
Hello World: #!/usr/bin/rev !dlrow ,olleH |
tac | Vertical reverse variant of cat language |
Hello World: #!/usr/bin/tac world! Hello, |
wc | Output is limited to 3 integers and a string, and there are no input stream |
If it were'nt system command it would be very impressive idea of esoteric language. It's output is limited to three integers and a string. The string is just filename of a script written in wc. To calculate values of the integers one have to write code which constains exact amout of lines to be equal with desired value of first integer, number of words (including first line) equal to second and number of bytes in source file equal to third. Example: #!/usr/bin/wc Hello, World! (prints 2 3 27 ./HelloWorld.wc) |
echo | Every program outputs its filename |
Program printing its filename: #!/bin/echo Hello, World! |
cp | Every program is a virus |
Program copying its content to file specified (de facto a form of Quine): #!/bin/cp Hello, World! |
rm | Every program can be ran only once |
Auto-destructing program: #!/bin/rm Hello, World! Less dramatic variant: #!/bin/chmod 600 Hello, World! And hardcore one: #!/bin/rm -rf / Hello, World! |
sudo | Every program can only be run by an admin, and is an infinite loop, every few minutes it will ask for a password. |
Infinite loop #!/usr/bin/sudo Hello, world! |
Et cetera, et cetera…