I'm trying to automate the installation of CUDA on an Ubuntu 18.04 VM template as part of the startup script. I'm very new to bash and cloud computing in general. When I run the command to install CUDA, mid-installation I am always prompted to choose a country and a language from a list of options by entering the corresponding ID numbers.
Basically, when I run:
sudo apt-get -y install cuda
I know I'm going to have to manually enter "31" and "1" for the install to complete. As a relative n00b at all this, my question is thus "How do I automate those inputs so I don't have to manually type them in every time I spin up a fresh copy of this VM template?"
My initial approach was this:
printf "31\n1\n" | sudo apt-get -y install cuda
But this does not seem to work the way I expected it to. No input is autofilled.
My end goal is to have everything taken care of in one startup script that I don't have to touch.
I appreciate any and all help, and I apologize if my question has been answered elsewhere (if it has, I've been unable to find it and would greatly appreciate being directed to it!)