Mars
Mars

Reputation: 4995

Installing applications in a script in Linux

When I install an application via sudo apt-get install application, there is a prompt indicating the amount of disk space the application will fill and asks whether or not I want to continue. To continue I would type y and enter.

If I put the command in a script, how can I have the y and enter execute automatically?

Upvotes: 1

Views: 307

Answers (1)

Petr Skocik
Petr Skocik

Reputation: 60056

You can either use yes to supply an infinite amount of y's:

yes|sudo apt-get install ...

or you can use the -y flag for apt-get install

sudo apt-get -y install ...

Alternatively, you can use --force-yes with apt-get to force even potentially dangerous actions. (See man apt-get for more information about options to apt-get.)

Upvotes: 1

Related Questions