开发者

Is there way to run a file with instruction in the erlang shell?

I have a file .erlang in the current dir I run erl shell that compiles a few modules.

Is there way to re run this file from the Erlang shell.

I run erl I get the shell 1> and from there run like run_file(".erlang") 开发者_StackOverflow社区and this file execute the instructions in the current shell and load the env.

The file looks like

compile:file(file1). 
compile:file(file2).
compile:file(file3).
...


You're looking for file:eval/1.

Given a .erlang with this content:

io:format("Hello world!~n").

You get:

Eshell V5.7.5  (abort with ^G)
1> file:eval(".erlang").
Hello, world!
ok


You might want to look into escript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜