Closed toraritte closed 5 years ago
#!/usr/bin/env escript
% main(Args) ->
% io:format("~p~n", [length(Args)]).
main([]) ->
io:format("~p~n", [[]]);
main(Args) ->
io:format("~p~n", Args).
When invoked as
$ cat .gitignore | ./program
the single argument of main
will be an empty list. (Check by inverting the comments above.)
https://gist.github.com/afrantisak/d293e9dc173f229048f0 https://elixirforum.com/t/io-read-stdio-num-broken-in-1-2-6/2547 https://stackoverflow.com/questions/10872909/erlang-read-stdin-write-stdout
=> refresh memory on
io
andfile
modulesio
- http://erlang.org/doc/man/STDLIB_app.htmlfile
- http://erlang.org/doc/man/kernel_app.html