#!/usr/bin/env escript
%%% -*-erlang-*-
main(_) ->
{ok, S} = io:fread("", "~s"),
io:format("~s~n", [S]).
If you're on Windows, drop the first two lines (i.e. you just need the
main/1 function).
Then run:
echo "yo Irina" | escript erlecho
I *think* this is what you're asking for :) See the docs on io:fread/2
- it's a nice interface to stdin I think.
There are some other interesting ways to get Java to talk to Erlang
(e.g. jinterface - see
http://www.erlang.org/doc/apps/jinterface/users_guide.html) and good
ol' REST, but of course that's all quite a bit more involved.