bash - what's the correct way to pipe input to a program's internal command line? -


I'm trying to automate the installation of Sqoop 2 . Assume that sqoop-server is installed in the IP address 1.2.3.4 . I want to set the IP of that server on sqoop-client Manually, to do this, I would:

  sqoop2 sqoop: 000 & gt; Set Server - Host 1.2.3.4  

How do I do the shell using the pipe and echo ? I have tried

  set server - host 1.2.3.4 | Sqoop2  

but it did not work much.

Read from many interactive programs stdin . Let's say this is the case for sqoop2 , as you suggest that you can use the pipe. But you just forget to use the echo command command:

  echo set server - host 1.2.3.4 | Sqoop2  

Set the output of the above code echo as the input to sqoop2 . Another option

  sqoop2 & lt; & Lt; & Lt; "Set Server - Host 1.2.3.4"  

There is a third option to use. Very useful if you have to send several commands:

  sqoop2  

(In the above, you can issue as many commands as you want, which ends before the EOF marker heredoc will then send all orders as the standard input of shell programs sqoop2


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -