I don't have much experience with bash scripting. What I am trying to do here might not be complicated but I just have some issues.
So I have a C script that I have to use to run on approximately 70,000 files. The script invoked certain inputs for me to enter one by one. e.g. it prompts me to enter (y/n) for yes or no 7 times one after the other. so for example, if I run the script on one file, it would prompt me to enter yes or no for something followed by multiple prompts asking (y/n). In this case there are 7 y/n prompts. It then goes on to prompt several other parameters that I enter once they are prompted e.g. c for continue, 100 for percentage etc.
All these paramters are the same for all the 70,000 files. I was wondering if someone can guide me on how to pass all these arguments to the bash script once they are prompted. Pretty basic but this is what I have so far:
var='testdir/*'
for i in var; do
/script $i
done
the above bash commands invoke the script but prompt me to input all those parameters for each file. Note: I can not manipulate the underlying script.
printf 'yes\ny\ny\ny\ny\ny\ny\ny\n' | script $i
or whatever, to see if your script definitely still prompts for input on the terminal instead of first accepting those first "yes" and "y" inputs? If you have definitely verified it uses the terminal it's attached to, then usingexpect
, per the only current answer, is probably the easiest.