[erlang-questions] shell question - import commands from external file

Robert Raschke rtrlists@REDACTED
Mon Sep 21 10:38:16 CEST 2009

On Mon, Sep 21, 2009 at 6:53 AM, Bopolissimus Platypus Jr <
bopolissimus.lists@REDACTED> wrote:

> Hi all,
> I have a newbie question.  In the shell, is there a way to import
> *shell* commands from
> an external file?  I'm often experimenting in the shell, e.g., writing
> a 5 or 8 line fun,
> trying out this or that function call, etc.
> Since there are often mistakes, I need to rewrite the fun a few times.
>  Instead of
> having to retype (or look up in history) the several lines, I'd like
> to write the fun
> in a temporary file (e.g., ./tmp.erl) and then just load it into the
> shell as if i'd
> typed it in (e.g., in the postgresql shell I would do, "\i [filename").
I don't think there is any mechanism that would allow you to evaluate text
in a file that contains shell commands like f(), c(), etc.

But maybe file:consult/1, file:eval/1 or file:eval/2 might be close enough
to what you're looking for?


More information about the erlang-questions mailing list