Escript: Running Erlang As Scripts
June 10th, 2007
(以下摘抄自Programming Erlang第六章)
Using escript you can run your programs directly as scripts—there’s no need to compile them first.
Warning: escript is included in Erlang versions R11B-4 and onward. If you have an earlier version of Erlang, then you should upgrade to the latest version of Erlang.
To run hello as an escript, we create the following file:
#!/usr/bin/env escript
main(_) -> io:format("Hello world\n" ).On a Unix system,we can run this immediately and without compilation as follows:
$ chmod u+x hello $ ./hello Hello world $




June 6th, 2008 at 04:30 PM 很高兴发现了您的blog,曲径通幽处啊,我现在才开始学习erlang,以后洗完更多跟您交流呢。