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 <<<yes
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
The PyQt configure script has an option which automatically confirms acceptance of the licence:
python configure.py --confirm-license
Since there are no other parts of the PyQt installation process that require user input, that should be all you need. For more details, see Installing PyQt4 in the PyQt Docs.
You can provide input using pip operator (thanks ShadowRanger) Example:
echo "yes" | command
echo "pass" | ssh user@pass