Não vejo opções que fazem com que apt
(ou apt-get
) ignore um pacote inexistente e continue instalando os outros.
No entanto, você pode executar apt install
para cada pacote em sua lista separadamente, assim um pacote inexistente não aborta a instalação dos outros.
Um simples loop Bash for
é muito útil aqui:
sudo bash -c 'for pkg in cowsay cowtalk ; do apt install $pkg ; done'
Este comando executa um loop for
em um shell Bash com privilégios de root. O próprio loop executa apt install PACKAGE
para cada PACOTE na lista cowsay cowtalk
.
Enquanto cowsay
existe, cowtalk
não. Você vê a saída aqui:
$ sudo bash -c 'for package in cowsay cowtalk ; do apt install $package ; done'
[sudo] password for bytecommander:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
cowsay-off
Suggested packages:
filters
The following NEW packages will be installed
cowsay cowsay-off
0 to upgrade, 2 to newly install, 0 to remove and 0 not to upgrade.
Need to get 21,7 kB of archives.
After this operation, 112 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ftp.uni-stuttgart.de/ubuntu xenial/universe amd64 cowsay all 3.03+dfsg1-15 [18,0 kB]
Get:2 http://ftp.uni-stuttgart.de/ubuntu xenial/universe amd64 cowsay-off all 3.03+dfsg1-15 [3.640 B]
Fetched 21,7 kB in 0s (117 kB/s)
Selecting previously unselected package cowsay.
(Reading database ... 304276 files and directories currently installed.)
Preparing to unpack .../cowsay_3.03+dfsg1-15_all.deb ...
Unpacking cowsay (3.03+dfsg1-15) ...
Selecting previously unselected package cowsay-off.
Preparing to unpack .../cowsay-off_3.03+dfsg1-15_all.deb ...
Unpacking cowsay-off (3.03+dfsg1-15) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up cowsay (3.03+dfsg1-15) ...
Setting up cowsay-off (3.03+dfsg1-15) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package cowtalk