与shell脚本中的run_erl一起运行的Erlang shell进行通信

时间:2011-03-14 09:25:28

标签: erlang sh io-redirection run-erl

我有一个通过run_erl运行的Erlang应用程序。它会创建文件erlang.pipe.1.werlang.pipe.1.r,我可以通过to_erl启动控制台。到现在为止还挺好。然后我需要从shell脚本中与它交谈。显而易见的事情是

#!/bin/sh

EXPR=$1
PIPE_DIR=/tmp/mware
PIPE=$PIPE_DIR/erlang.pipe.1.w

echo $EXPR >> $PIPE

最初它有效,但现在我收到了错误:

-sh: can't create erlang.pipe.1.w: Interrupted system call

ls表示该文件已存在。出了什么问题,我该如何解决?

2 个答案:

答案 0 :(得分:2)

您是否尝试过使用竖线(|)而非追加(>>)。 E.g。

echo 'io:format("hello ~p", ["world"])' | to_erl $PIPE_DIR

答案 1 :(得分:1)

我对你目前正在使用的方法并不熟悉,但我之前给出了一些three methods of connecting two nodes from the shell的例子。也许在途中有所帮助。干杯!