【发布时间】:2009-08-31 17:25:41
【问题描述】:
我正在寻找一种将输入从文件转储到终端的方法,但是当达到 EOF 时,我希望输入返回到我的键盘。有没有办法使用 Bash(或任何其他常用的 *nix shell)来做到这一点?
详情: 我正在调试一个执行分叉以启动子进程的服务器程序。每次我使用 gdb 启动调试会话时,我都必须输入 set follow-fork-mode child。我想使用某种输入重定向来预先填充它。我还可以想到其他用途,所以我更喜欢通用解决方案 - 因此这个问题不是关于 gdb。
解决方案: start-server.sh
#!/bin/bash
cat run-server.txt - |/bin/bash
run-server.txt
gdb ./Server
set follow-fork-mode child
run
【问题讨论】:
标签: bash shell input redirect stdin