Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

write a unix pipe program in Erlang?

Erlang pipe program Unix write
0
Posted

write a unix pipe program in Erlang?

0

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 ~/.

0

Lots of useful utilities in unix can be chained together by piping one program’s output to another program’s input.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.