[erlang-questions] Something like csh "source" command in Erlang shell?

Ulf Wiger ulf.wiger@REDACTED
Thu Jul 8 15:34:36 CEST 2010


I don't think that can be done out of the box. Some assembly
is certainly required.

I wrote a small code snippet to allow saving the shell history
to a file in a format that can be handled by file:eval/1 or
file:script/1 (the difference between the two is that the latter
returns the result of the last expression, while file:eval/1
only returns 'ok').

http://gist.github.com/468003

The code doesn't bother checking whether the commands were
successful before saving, but this could be added.

How to restore the bindings in the shell would be another
challenge. I've not looked into whether it can be done without
hacking the evaluator.

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd
http://www.erlang-solutions.com


More information about the erlang-questions mailing list