I am trying to automate stuff which includes installing rust through
curl https://sh.rustup.rs -sSf | sh .
This is interactive and queries for user-input to choose from i.e. "1" "2" or "3".
I am not able to figure out how to input values automatically.
For example with apt-get
, there is a -y
option try to capture and input for prompt.
Not sure, how it is done for curl
.
Best Answer
Checking the script file, you can use the
-y
option:To add
-y
as an argument in that pipeline, usesh
's -s
option:-s
tellssh
to read commands from input, and--
passes the remaining arguments to the script (read from input), so-y
is set as an argument to the script.Or, if you have bash, use process substitution: