How can I pipe initial input into process which will then be interactive?

后端 未结 4 1446
长发绾君心
长发绾君心 2020-11-27 03:56

I\'d like to be able to inject an initial command into the launching of an interactive process, so that I can do something like this:

echo \"initial command\         


        
4条回答
  •  -上瘾入骨i
    2020-11-27 04:14

    You don't need to write a new tool to forward stdin - one has already been written (cat):

    (echo "initial command" && cat) | some_tool
    

    This does have the downside of connecting a pipe to some_tool, not a terminal.

提交回复
热议问题