bash - 如何从脚本在 iex 中运行命令?
问题描述
我正在尝试编写一个简单的脚本来启动 IEX 的不同节点,每个节点都有它的名称,并希望这些节点执行 de Node.ping :node_name@hostname 但我没有找到任何东西。
这是我目前拥有的脚本:
#!/bin/bash
#Opens 3 clients
gnome-terminal --command="bash -c 'iex --sname client1; $SHELL'"
gnome-terminal --command="bash -c 'iex --sname client2; $SHELL'"
gnome-terminal --command="bash -c 'iex --sname client3; $SHELL'"
#Opens de server
gnome-terminal --command="bash -c 'iex --sname server; $SHELL'"
解决方案
不能iex
以任何其他方式“管道”命令或将其发送到正在运行的实例,但幸运的是,人们可能会利用使用.iex.exs
文件。
创建一个目录,.iex.exs
在其中创建一个包含您想要的任何内容的目录,然后在其中运行您的脚本。
请注意,需要先调用Node.connect/1
才能Node.ping/1
成功。
推荐阅读
- html - 如何拉伸左侧“行”以填充左侧?我使用引导程序
- php - PHP如何在我的变量中包含未知数量的数组
- android - 如何在回收站视图中添加 onclciklistner 及其位置
- javascript - 尝试使用 VueJS 过滤数组并仅显示结果
- powershell - 在 PS 脚本中处理 PSSession
- c - "%13s" 或 "%13d" 在 C 中代表什么
- javascript - 是否可以在不了解移动应用程序前端的情况下构建 REST API
- c# - 使用“TAP”设计模式执行许多长时间运行的任务
- sql - 在 WHERE 子句中使用短路会提高速度吗
- spring - 如何在spring boot的主项目(有两个依赖项目)中使用message.properties文件?