Pregunta

How to put a text string from file to the end of a command?

What I want to is to use sudo dpkg -i with | or < or > (or whatever else) to input the strin from file in which would be the package names. To demonstrate it:

$ ls
file  pkg1.deb  pkg2.deb  pkg3.deb  pkg4.deb

$ more file
pkg1.deb pkg3.deb

$ sudo dpkg -i < file

and the installation of the selected packages should run.

Info: I am using Ubuntu 13.10 i386

¿Fue útil?

Solución

$ sudo dpkg -i $(<file)

ought to work, assuming that dpkg -i can take multiple package names (don't have a debian box around to check). If not:

for X in $(<file) ; do sudo dpkg -i "$X" ; done
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top