[erlang-questions] [Erlang-Q] What does Ctrl+G do for the Eshell?

Robert Virding <>
Tue Oct 4 13:54:25 CEST 2011


Hi, 

It was created back in the days when we were thinking of Erlang as more of an OS where you could run multiple "jobs" at the same time. Apart allowing you to start many concurrent jobs, not just the shell, it also multiplexes the i/o so only the connected job (the 'c' command) gets access, both read and write, to the user terminal. I/o to the other jobs is blocked. Otherwise having mixed i/o to/from many jobs at the same time becomes a right mess. 

The ^G works as all user terminal input passes through this layer. Now it should maybe be rewritten to use separate windows instead? If we ever get a "standard" window interface. :-) 

The name JCL (Job Control Language) is a joke on IBM's JCL which they used back in the old days to control their batch jobs. It was if course completely different. 

Robert 

----- Original Message -----

> Such a fabulous facility! Thank-you for telling!
> On Oct 4, 2011 6:13 AM, "Anders Ramsell" < 
> > wrote:
> > Barco You wrote:
> >> Hello Erlangers,
> >>
> >> When starting a erl shell, we will see a printout as:
> >> Eshell V5.8.4 (abort with ^G)
> >>
> >>
> >> then, I tried to press Ctrl+G and got:
> >> User switch command
> >> --> ls
> >> Unknown command
> >> --> q().
> >> Unknown command
> >> -->
> >>
> >> I can do nothing with the prompt "-->". How to quit from it? and
> >> what's "Ctrl+G" used for?
> >>
> >>
> > The words "abort with ^G" are in fact hiding an extremely useful
> > function called JCL (job control mode) [1]. I overlooked this
> > function for years. Now I use it on a near daily basis and just
> > love it.
> >
> > [1] http://www.erlang.org/doc/man/shell.html
> >
> > Assume you have an Erlang node named '' running as a
> > service/daemon on your system. Wouldn't it be great if you could
> > run interactive commands on this node just like you do in a
> > shell? JCL let's you do that with ease.
> >
> > Start up a new shell '' and hit ctrl-G to enter JCL.
> > Now start a remote shell to ''.
> >
> > | ()1>
> > | User switch command
> > | --> r 
> > | --> j
> > | 1* {shell,start,[init]}
> > | 2 {,shell,start,[]}
> >
> > You now have a local shell with id=1 and a remote shell with
> > id=2. Connect to the remote shell:
> >
> > | --> c 2
> > |
> > | ()1>
> >
> > Now you have a shell on the server node where you can run any
> > command you want. This means you can call any exported function
> > in all modules loaded on the server. That kind of interaction
> > with a running system can be invaluable when trying to figure out
> > why it doesn't behave quite the way you planned.
> >
> > Now of course there is a backside to the story. Doing something
> > wrong may cause your system to crash. So hey - let's be careful
> > out there.
> >
> > /Anders
> >
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://erlang.org/mailman/listinfo/erlang-questions

> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111004/727fa29b/attachment.html>


More information about the erlang-questions mailing list