0

I am executing a unix command which basically requires response/input from user after pressing ENTER on the first command (copy ftp: flash:). See my commands below.

copy ftp: flash:
Address or name of remote host []? **xx.yy.zz.sa**
Source filename []? **sourceFile.bin**
Destination filename [sourceFile.bin]? **dest.bin**
Accessing ftp://xx.yy.zz.sa/sourceFile.bin...

Now my ask is that I want to execute above set of command (& sub-commands) in a single line (which should include all responses by user) as I will be using this single line command in my Java program. Any pointers for this ?

Vaibhav Bhardwaj
  • 179
  • 1
  • 1
  • 9
  • Pipe is not working in this case. Pipe won't work here as after each command, user is asked to provide response as well. How can we provide response using the pipe. – Vaibhav Bhardwaj Oct 08 '21 at 14:50
  • ??? What *each command*? You wrote about one command only... Your command might have subcommands. But technically, there's no difference between those subcommands and responses to the subcommand prompts. Those all are just lines of input to the main command. – Martin Prikryl Oct 08 '21 at 15:08
  • Actually there is only one command 'copy ftp: flash:' and then there are subsequent responses from user when user press enter after the command ''copy ftp: flash:''. Now I have to write whole thing, either in single line (which should contain all responses) or some kind of shell script which has pre-determined responses for the command. – Vaibhav Bhardwaj Oct 12 '21 at 14:38
  • Did you read this? *"technically, there's no difference between those subcommands and responses to the subcommand prompts. **Those all are just lines of input to the main command.**"* – Martin Prikryl Oct 12 '21 at 15:41
  • @Martin Prikryl : I understand sir what are you saying. As per you, those are lines of input to the main command. Is it possible to write main command and sub-commands in a single line ? Can you please help me in writing that single line ? – Vaibhav Bhardwaj Oct 12 '21 at 21:14
  • Did you see the answer by @codeforester in the duplicate question? – Martin Prikryl Oct 13 '21 at 05:40

0 Answers0