write a unix pipe program in Erlang?
Lots of useful utilities in unix can be chained together by piping one program’s output to another program’s input. Here’s an example which rot-13 encodes standard input and sends it to standard output: -module(rot13). -export([rot13/0]). rot13() -> case io:get_chars(”, 8192) of eof -> init:stop(); Text -> Rotated = [rot13(C) || C <- Text], io:put_chars(Rotated), rot13() end. rot13(C) when C >= $a, C =< $z -> $a + (C – $a + 13) rem 26; rot13(C) when C >= $A, C =< $Z -> $A + (C – $A + 13) rem 26; rot13(C) -> C. After compiling this, you can run it from the command line: matthias> cat ~/.