Reputation: 299
I would like to build a script like this:
#!/bin/bash
/path/to/my/program/myProgram
MyCommand1 < — This is NOT a bash command
MyCommand2 < — Neither is it
Those are commands acceptable only by some sort of interactive session of my program. Any ideas how do I do that?
Upvotes: 1
Views: 2608
Reputation: 19982
echo -e "MyCommand1\nMyCommand2"| /path/to/my/program/myProgram
or
/path/to/my/program/myProgram << EOF
MyCommand1
MyCommand2
EOF
When you want to have some delay in your input, try this:
(sleep 2; echo "MyCommand1"; sleep 1; echo "MyCommand2") | /path/to/my/program/myProgram
Upvotes: 2