相关疑难解决方法(0)

将字符串发送到stdin

有没有办法在bash中有效地做到这一点:

/my/bash/script < echo 'This string will be sent to stdin.'
Run Code Online (Sandbox Code Playgroud)

我知道我可以管道回声的输出,如下所示:

echo 'This string will be piped to stdin.' | /my/bash/script
Run Code Online (Sandbox Code Playgroud)

bash redirect stdin io-redirection

144
推荐指数
3
解决办法
15万
查看次数

标签 统计

bash ×1

io-redirection ×1

redirect ×1

stdin ×1