


Please let me know if there is something inherently wrong about it. How to automate providing input to a prompt using bash? Then run it as an executable script from the terminal. sh file and make it executable using chmod +x. Then, you could put any command-line instructions inside the loop and use the variable $i, passing it as an argument for the instruction. The loop will iterate through the numbers 1 to 1030. Group all the echo commands and pipe them to the command: | somecommand Here's a similar question that suggests using Expect: Use expect in bash script to provide password to SSH command Using Bash Script to feed input to command line

Or try pexpect if you're more comfortable with Python. How to input automatically when running a shell over SSH?įor general command-line automation, Expect is the classic tool.
