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.
精彩评论