小编use*_*289的帖子

与来自不同进程的正在运行的交互式控制台程序进行交互

我有一个带有交互式 shell 的控制台程序,类似于 Python 交互式 shell。有没有一种简单的方法可以启动这个交互式程序A,然后使用另一个程序B来运行A?我想做这样的事情:

$ /usr/bin/A&
$ #find PID of A somehow
$ somecommand "PID of A" "input string to send to A"
output string from A
$
Run Code Online (Sandbox Code Playgroud)

什么样的“somecommand”可以做到这一点?这是“期望”应该促进的吗?我阅读了expect手册页,但仍然不知道它的作用。

shell scripting bash background-process

5
推荐指数
1
解决办法
7663
查看次数

标签 统计

background-process ×1

bash ×1

scripting ×1

shell ×1