Ask Your Question
4

Is it possible to get DNF to install packages listed in a text file?

asked 2015-11-06 07:22:42 -0500

updated 2015-11-07 14:42:10 -0500

I am writing a shell script for installing Moksha (the E17 fork used by Bodhi Linux) on Fedora 23 and it would help if I could get DNF to install packages listed in a plain text file (.txt).

Such a text file might be formatted like this, for example:

autoconf 
elementary 
dbus-devel 
gettext-devel 
glib-devel
.  .   .

with each package name on a different line, if it makes any difference to DNF.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
6

answered 2015-11-06 07:53:43 -0500

skytux gravatar image

First thing that comes to my mind:

# dnf install $(cat list.txt)
edit flag offensive delete link more

Comments

1

Thanks, works perfectly.

Brenton Horne gravatar imageBrenton Horne ( 2015-11-06 08:06:23 -0500 )edit
3

answered 2018-07-19 10:43:42 -0500

abitrolly gravatar image

I used grep to also ignore commented lines in list.txt for fedora-packages.

# dnf install $(grep "^[^#]" list.txt)
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-11-06 07:22:42 -0500

Seen: 4,068 times

Last updated: Jul 19 '18