automate responses on command prompt

Is there any way to automate the installation of this software using shell script? The problem is that I have to press ENTER and type YES twice and I am not sure how to use these 4 steps.

wget https://github.com/conda-forge/miniforge/releases/download/4.8.3-4/Miniforge3-Linux-aarch64.sh

bash Miniforge3-Linux-aarch64.sh

When I run the command mentioned above, I have these 4 steps:

 press ENTER
 type YES
 press ENTER
 type YES

I want to add this installation as a shell script in docker file or (if possible) directly in dockerfile.

2 answers

  • answered 2020-07-05 02:12 Gilles Quenot

    Like this:

    chmod +x Miniforge3-Linux-aarch64.sh
    ./Miniforge3-Linux-aarch64.sh -b 
    

    (batch mode).

    Check:

    ./Miniforge3-Linux-aarch64.sh -h
    

    -b run install in batch mode (without manual intervention), it is expected the license terms are agreed upon

  • answered 2020-07-05 02:22 SomeUsername1

    You could use the functions expect & send from the package expect.

    Man Page
    Answer found here