Using Bash Script to feed input to command line

后端 未结 1 1413
傲寒
傲寒 2020-12-10 23:14

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 co

相关标签:
1条回答
  • 2020-12-10 23:58

    A couple of ways.

    Group all the echo commands and pipe them to the command:

    { echo $firstname; echo $lastname ; } | somecommand
    

    or use a heredoc:

    somecommand <<EOF
    $firstname
    $lastname
    EOF
    
    0 讨论(0)
提交回复
热议问题