linuxubuntu

run rustup's curl-fetched installer script non-interactively


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".

Not able to figure out, how to input.

Normally for apt-get, "-y" option try to capture and input for prompt.

Not sure, how it is done for curl.

How can I do this?


Solution

  • To make the installation unattended you can run

    curl https://sh.rustup.rs -sSf | sh -s -- -y
    

    If you are ssh'd you should add the nohup parameter in front

    With the -s parameter, you set sh to read commands from the standard input, and then you pass the -y to auto accept the options

    For more info about sh you can see the man pages