我知道如何在这样的程序中将命令作为输入发送:
echo toto | ./my_prog
并使用进程替换 + 重定向:
r < <(echo toto)
但是如果我想输入第二个或第三个输入怎么办?
例如,我有一个程序,它首先询问我的用户名,然后询问我其他信息,例如电话号码或其他不同输入的信息。
command-line shell input
command-line ×1
input ×1
shell ×1