[erlang-questions] Something like csh "source" command in Erlang shell?
Mats
mats.westin@REDACTED
Thu Jul 8 16:30:13 CEST 2010
Screen can receive text as if you were typing it.
Start erlang inside screen with:
screen -S erl_screen erl
Send a file:
screen -S erl_screen -p 0 -X stuff "`cat hist_erl`"
A cr with:
screen -S erl_screen -p 0 -X stuff $'\n'
Quit your session with:
screen -S erl_screen -p 0 -X quit
On Thu, Jul 8, 2010 at 12:47 PM, Michael Turner <
michael.eugene.turner@REDACTED> wrote:
> Is there some way to read in a bunch of Erlang shell commands as if they'd
> been typed in? I'm thinking of something like the "source" command in csh.
>
> OK: why? That's a reasonable question.
>
> The reason I want this: I started into a tutorial for wx that was very
> command-line intensive, showing how you call wx to put up a window, put a
> menu in that window, put an item in that menu, etc., just by issuing
> commands in the shell. I was quite delighted to see that Erlang is almost
> like Tcl/Tk's tclsh in this respect. Perhaps it's an under-appreciated
> feature of graphics programming for Erlang.
>
> If you don't mind stuffing a lot of callbacks into fun-valued variables,
> you
> can actually bring up a whole little GUI through which you can actually do
> stuff, just by typing commands into the Erlang shell.
>
> But then if you q() out, it all goes away.
>
> What I'd like to do here is to tell the tutorial reader to copy-paste the
> commands of interest to a file, one that can be read back in as a series of
> commands, not only to rebuild the GUI being assembled interactively, but
> also to reestablish --*in the Erlang shell session* -- the variable
> bindings made by the commands. Eventually, of course, you want the reader
> of the tutorial to either throw all that out or package it more cleanly in
> a
> module, before continuing. In the meantime, though, it would give them a
> way to "pick up where they left off" in an ongoing command line dialogue,
> by
> reading in all the commands they wanted to keep, in the order they issued
> them. Not to mention that having all the commands of interest, in order,
> batched in a text file, makes for easier review. I think for learning even
> the rudiments of something as sprawling as wx, this approach, "today's
> commands after re-reading, then re-using, yesterday's", would be helpful.
>
> Is there something like this in the Erlang shell, either undocumented or so
> under-documented that I keep missing it?
>
> -michael turner
>
More information about the erlang-questions
mailing list