deraffe / red_green_blue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RED GREEN BLUE

Inspired by https://utcc.utoronto.ca/~cks/space/blog/unix/ShellPipelineIndeterminate

( echo red ; echo green 1>&2 ) | echo blue

Quoting Hackaday:

You’d like to think it prints three lines: red, green, and blue. But
would you be surprised to find out that it can sometimes output
“blue green” and sometimes just output blue. The first surprise is
that it isn’t deterministic. But the second thing that is surprising
is the sometimes the entire left-hand part of the line doesn’t do
anything.

Recommended test can be found in test.sh.

source test.sh

About


Languages

Language:Shell 100.0%