title: Running erlang shell command, via console, in an already-running shell
body: <p>Good morning !</p>
  
  <p>I'm trying to set up a communication between an erlang shell and an external function (zenity) that communicates only via scripts.(It can only run command lines)</p>
  
  <p>In my program, the erlang shell is already running and spawned nodes that I need. (So opening an other shell to run the functions doesn't work, and <code>escript</code> opens a new shell. I need to run the functions from my main shell) </p>
  
  <p>This is what I manualy do, and would like to script it.</p>
  
  <pre><code>$ erl -name two@127.0.0.1 
  Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
  Eshell V7.3  (abort with ^G)
  (two@127.0.0.1)1&gt; c(client). 
  {ok,client}
  (two@127.0.0.1)2&gt; client:init(). 
  true
  (two@127.0.0.1)3&gt; 
  </code></pre>
  
  <p>The <code>client:init()</code> spawns threads. And I communicate with them via some functions.</p>
  
  <p>From here I run my different functions with </p>
  
  <pre><code>client:&lt;function&gt;(&lt;Args&gt;).
  </code></pre>
  
  <p>But a script whith</p>
  
  <pre><code>erl -name two@127.0.0.1
  c(client).
  client:init()
  client:&lt;function&gt;(&lt;Args&gt;).
  </code></pre>
  
  <p>Obviously, it does not work.</p>
  
  <p>I can shorten this a bit with</p>
  
  <pre><code>$ erl -name two@127.0.0.1 -s client init
  </code></pre>
  
  <p>But I still can't run functions on the shell that was created, because the function to call depends on the outputs of Zenity that only communicates via shell command lines</p>
  
  <p>Are there solutions to run erlang command via a script ?</p>