Erlang/OTP Forums

Author Message

<  User Contributions  ~  Separate remote shell and local shell

datacompboy
Posted: Thu Aug 09, 2012 6:36 am Reply with quote
User Joined: 21 Sep 2006 Posts: 69 Location: Novosibirsk, Russia
When you run local shell (in screen f.e.) you should exit via Ctrl+A, Ctrl+D.
When you run remsh shell, you should exit via double Ctrl+C.

Put a.erl:
Code:

-module(a).
-compile(export_all).
b(P) ->
    N = proplists:get_value(history, P, 0),
    leader() ++ cur() ++ io_lib:format("~w>", [N]).

cur() ->
    case node() of
        nonode@nohost -> "";
        N -> io_lib:format("(~w)", [N])
    end.

leader() ->
    case {node(erlang:group_leader()), node()} of
        {N,N} -> "";
        {N,_} -> io_lib:format("[~w]", [N])
    end.


Now, run main node: erl -sname m -stdlib shell_prompt_func "{a,b}"
Code:
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [kernel-poll:false]

Eshell V5.9.1  (abort with ^G)
(m@ccc)1>


Attach to it with remote shell: erl name z -remsh m@ccc
Code:
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [kernel-poll:false]

Eshell V5.9.1  (abort with ^G)
[z@ccc](m@ccc)1>


Now its clear, where you are.

_________________
--- suicide proc near\n call death\n suicide endp
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum