Erika
Erika

Reputation: 255

How to input text to program running in terminal immediately

I wrote a very simple bash script to try to input the word "password" into a program running in terminal.

./program
echo "password"

But when I run this script, "password" is printed after the program finishes running. How can I use the script to input "password" into the program immediately?

Upvotes: 0

Views: 161

Answers (1)

df778899
df778899

Reputation: 10931

Sounds like a job for piping

echo "password" | ./program

Upvotes: 1

Related Questions