tukusejssirs
tukusejssirs

Reputation: 854

append text string from file to a command

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

Upvotes: 0

Views: 62

Answers (1)

user3392484
user3392484

Reputation: 1919

$ 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

Upvotes: 1

Related Questions