I have a simple java program (think of it as Apple's Siri) that, when started from a terminal, waits for a user to type in a question and then it prints out a reply. I would like to make a bash script that starts the java program and then gives it a couple of questions (just as if a human was typing them in). This is what I tried:
#!/bin/bash
# change to project directory
cd C:/JavaProjects/VirtualButler
#compile the program
javac Alfred.java
#start the program
java Alfred
#Give it questions
echo Hey what time is it?\r
echo When is my next meeting?\r
#keep the terminal open so I can see the answer
PAUSE
However, when I run the bash script, the processing gets stuck at Java Alfred line (which is running on the open cmd, waiting for the user to type in questions and use the program. Only when I terminate the Java program, the processing moves on and gets to the questions that I want to automatically pass to the Java program. Is there a way to automatically pass these questions to the java program while it is running in the cmd?