Erlang one-liners with eval on remote shell

880 Views Asked by At

I am trying to have erlang run a small piece of code on a remote machine with a remote shell connection

erl $ERL_COOKIE -name ${SHELL_NAME} -remsh ${REMOTE_SHELL} -eval 'io:fwrite("~p",[registered()]), init:stop()'

The eval is not executed on the remote system, it's in some local bootstrap instead. I also tried -run and -s. Is there some way to do this from erl?

1

There are 1 best solutions below

0
On

If you look at the documentation of init and erl you will see that the expression for -eval is evaluated by init in current erlang node and not by a shell. So using -remsh to start a shell connected to another node does not affect where -eval, or -run and -s, runs.