Originally posted by nicholasbs:
I'm writing a shell script which deals with a command line app which runs, outputs to a file and then waits for the user to press return. How can I make my shell script "press" return automatically (or after a certain amount of time)? Is this possible?
There's not really a way. Some shell scripts/cli programs will take input from a file, so you can do:
somecommand << my_file_of_inputs_with_carriage_returns
But that is generally not for what you're talking about. Some commands can take input from standard input. Look for another way to do what you want.
For example, if you wanted to do a sudo command, but did not want to be prompted for your password, you could do:
echo "mypassword" | sudo -S "touch /etc/foobar123"
Just an example.