I have a script StartProcess.sh
that accepts two options in stdin
- 3
and a filename test.xml
.
If I run the below script, it executes correctly, and waits again for the input.
I want someway to pass 3
and test.xml
n
times to StartProcess.sh
. How do I achieve this.
./StartProcess.sh << STDIN -o other --options
3
test.xml
STDIN
You can run a loop to pass the arguments as many times in a loop and run a script over a pipe-line. That way, the script is just launched once and the arguments gets sent over stdin any number of times of your choice
count=3
for (( iter = 0; iter < 3; iter++ )); do
echo "3" "test.xml"
done | StartProcess.sh
But I'm not fully sure if you wanted to pass the literal string test.xml
as an argument or the content of the file.