I have a problem which do not really know how to ask. I will try to explain as best as possible.
I have to automate an installation process using a bash script. In the
While a particularly difficult script might do some magic to explicitly read from the terminal rather than stdin
, odds are you could just pipe to the script using bash pipeline syntax:
echo yes | python configure.py
or if you prefer, the "single command" version using bash
here string syntax:
python configure.py <<
Lastly, if you need to provide multiple lines of input, probably the easiest approach is bash's heredoc syntax:
# Remove the single quotes if you need to do variable interpolation in the
# heredoc; the delimiter ENDOFINPUT is arbitrary, it just has to be used
# (with or without single quotes) after the `<<` operator, and w/o quotes
# at the end of the input to terminate the heredoc
python configure.py <<'ENDOFINPUT'
yes
anotherresponse
andyetanother
ENDOFINPUT