Simon Fernandez Simon Fernandez - 9 days ago 4
Bash Question

Running erlang shell command, via console, in an already-running shell

Good morning !

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)

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

opens a new shell. I need to run the functions from my main shell)

This is what I manualy do, and would like to script it.

$ erl -name two@
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@> c(client).
(two@> client:init().

spawns threads. And I communicate with them via some functions.

From here I run my different functions with


But a script whith

erl -name two@

Obviously, it does not work.

I can shorten this a bit with

$ erl -name two@ -s client init

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

Are there solutions to run erlang command via a script ?


Why have you to run a command from zenity but not just grab result? (Or you can run echo.)

1> Port = open_port({spawn_executable, os:find_executable("zenity")}, [in, {line, 65536}, eof, {args, ["--calendar", "--title=Holiday Planner"]}]).
2> flush().
Shell got {#Port<0.490>,{data,{eol,"10/20/2016"}}}
Shell got {#Port<0.490>,eof}