Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的 bash 脚本中,我正在调用一个命令,该命令提示来自 STDin 的 2 个答案(连续)。我如何输入两者的答案?
使用heredoc,如下所示:
$ myscript.sh << EOF answer1 answer2 EOF
只需将输入分成两行。例如,
cat file.txt | your_command
哪里file.txt有
file.txt
input1 input2