Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-21-2010, 12:25 AM   #1
Registered: May 2008
Posts: 39

Rep: Reputation: 16
Lightbulb Shell script to install list of packages in a file

Hi friends,
I want to install a list of packages in the file.
i tried using yum install in a shell script,
while read -r line
echo "Package-->$line"
yum install $line
done < file1.txt

if i run this script:

Loaded plugins: refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gphpedit.i586 0:0.9.95-0.1.20090209snap.fc11 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================== =========================================================
Package Arch Version Repository Size
==================================================================================================== =========================================================
gphpedit i586 0.9.95-0.1.20090209snap.fc11 updates 453 k

Transaction Summary
==================================================================================================== =========================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 453 k
Is this ok [y/N]: Is this ok [y/N]: Is this ok [y/N]: Is this ok [y/N]: Is this ok [y/N]: Is this ok [y/N]: Is this ok [y/N]: Is this ok [y/N]: Exiting on user Command

Does anyone know how to solve this problem ????
Old 01-21-2010, 12:51 AM   #2
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
Change to "yum -y install $package".
Old 01-21-2010, 01:45 AM   #3
Registered: May 2008
Posts: 39

Original Poster
Rep: Reputation: 16

Originally Posted by quanta View Post
Change to "yum -y install $package".
Thanks for you help.
I did that, as per your instruction by default iam giving yes to all the packages, suppose if i want to get the input from the user whether to install it or not (yes or no), what i have to do ??
Old 01-21-2010, 06:29 PM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,406

Rep: Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396Reputation: 2396
man read
Old 01-22-2010, 01:56 AM   #5
Registered: Jan 2010
Distribution: Arch, Gentoo, FreeBSD
Posts: 64

Rep: Reputation: 16
You might try passing the entire list contents to a widget that allows the user to modify it, then pass the modified list to yum.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to save a list of installed packages and install these packages later mandavi Ubuntu 5 09-07-2009 11:36 AM
list filenames with spaces in a shell script xp_newbie Programming 6 03-15-2009 07:46 PM
Shell script to list all users in /etc/passwd file milestone Programming 6 09-15-2007 12:57 PM
Shell Script - filter list eluzi Linux - Software 3 03-17-2006 06:06 PM
Script to Remove a List of Debian Packages zael Programming 6 05-27-2004 05:36 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:03 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration