使用bash脚本来养活输入命令行 [英] Using Bash Script to feed input to command line
本文介绍了使用bash脚本来养活输入命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我试图让调用这个命令的bash脚本,然后馈电的输入。它调用这个命令,并且命令后3-4输入需求。我键入命令,它等待我进入第一个名字,一个我进入它等待我输入姓氏,等等名字。如何使用bash脚本来同时这些参数传递给命令吗?
So I am trying to make a bash script that calls this one command and then feeds it the input. It calls this one command and the command needs 3-4 inputs after. I type the command and it waits for me to enter first name, one I enter first name it waits for me to enter last name, and so on. How can I use bash script to pass these arguments to the command one at a time?
推荐答案
一对夫妇的方式。
集团所有的回声命令和管他们的命令:
Group all the echo commands and pipe them to the command:
{ echo $firstname; echo $lastname ; } | somecommand
或使用定界符:
somecommand <<EOF
$firstname
$lastname
EOF
这篇关于使用bash脚本来养活输入命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文