Hello, World! in Unix shell
Example for versions
Bash 4.0.35
This example uses dc (Desktop Calculator), which is a popular non-standard tool that allows processing arbitrary-precision numbers. | dc
means that dc has to be applied to the command.
P
command (the last character before | dc) outputs the last element of the stack. The huge number before P
when written in hexadecimal looks as 0x48656C6C6F2C20576F726C64210A; pairs of adjacent digits form ASCII-codes of characters of “Hello, World!”: 0x48 = H, 0x65 = e, 0x6c = l etc. Thus, when printed, this number is processed as a string.
echo 1468369091346906859060166438166794P | dc
Comments
]]>blog comments powered by Disqus
]]>