Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script.
Von meinem iPad gesendet
Hey Mark,
one quick and dirty possibility:
a=`yum check-updates | awk '{ print $2 }' |grep -v ":" |grep -v mirror |wc -l` ; echo $(($a - 1))
Best regards
Steffen
Once upon a time, mark m.roth@5-cent.us said:
Ralf Prengel wrote:
Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script.
yum check-update, perhaps?
Note that "yum check-update" or "yum list updates" won't tell you how many packages would be installed with "yum update"... dependencies and such are not resolved for check-update/list updates.
On Wed, May 22, 2019 at 7:49 AM Chris Adams linux@cmadams.net wrote:
Once upon a time, mark m.roth@5-cent.us said:
Ralf Prengel wrote:
Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script.
yum check-update, perhaps?
Note that "yum check-update" or "yum list updates" won't tell you how many packages would be installed with "yum update"... dependencies and such are not resolved for check-update/list updates.
otoh, its pretty rare that an update has a new dependency... if the package is installed, its existing dependencies are also installed, and if they have updates, check-update would show them all, would it not?
Once upon a time, John Pierce jhn.pierce@gmail.com said:
otoh, its pretty rare that an update has a new dependency... if the package is installed, its existing dependencies are also installed, and if they have updates, check-update would show them all, would it not?
It's not as rare as you might think, especially at point-release time. There are often new dependencies when packages get updates beyond just bug patching, sometimes an installed package might get obsoleted by a different package (can't remember if that shows up in check-update), etc.
Chris Adams wrote:
Once upon a time, mark m.roth@5-cent.us said:
Ralf Prengel wrote:
Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script.
yum check-update, perhaps?
Note that "yum check-update" or "yum list updates" won't tell you how many packages would be installed with "yum update"... dependencies and such are not resolved for check-update/list updates.
Ok, you want it all, fine: echo "n" | yum update | egrep "Install|Upgrade"
mark
yum check-updates 2>/dev/null|grep -A1000 "^$"|grep -vc "^$"
-- Sent from the Delta quadrant using Borg technology!
Nux! www.nux.ro
----- Original Message -----
From: "Ralf Prengel" ralf.prengel@rprengel.de To: "CentOS mailing list" centos@centos.org Sent: Wednesday, 22 May, 2019 14:42:53 Subject: [CentOS] how to find out the number of updates for a system
Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script.
Von meinem iPad gesendet _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
You might want to increase 1000 if you expect to have more than that number of updates :)
-- Sent from the Delta quadrant using Borg technology!
Nux! www.nux.ro
----- Original Message -----
From: "Nux!" nux@li.nux.ro To: "CentOS mailing list" centos@centos.org Sent: Wednesday, 22 May, 2019 15:48:00 Subject: Re: [CentOS] how to find out the number of updates for a system
yum check-updates 2>/dev/null|grep -A1000 "^$"|grep -vc "^$"
-- Sent from the Delta quadrant using Borg technology!
Nux! www.nux.ro
----- Original Message -----
From: "Ralf Prengel" ralf.prengel@rprengel.de To: "CentOS mailing list" centos@centos.org Sent: Wednesday, 22 May, 2019 14:42:53 Subject: [CentOS] how to find out the number of updates for a system
Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script.
Von meinem iPad gesendet _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
maybe yum -q check-update | wc -l
On 5/22/19 8:42 AM, Ralf Prengel wrote:
Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script.
Von meinem iPad gesendet _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
Nice one, -q However that command will still count an empty line that yum outputs, even with -q; it could also create problems due to stderr. I'd use something like: yum -q check-update 2>/dev/null|grep -c -v ^$
-- Sent from the Delta quadrant using Borg technology!
Nux! www.nux.ro
----- Original Message -----
From: "SternData" subscribed-lists@sterndata.com To: "CentOS mailing list" centos@centos.org Sent: Wednesday, 22 May, 2019 16:03:39 Subject: Re: [CentOS] how to find out the number of updates for a system
maybe yum -q check-update | wc -l
On 5/22/19 8:42 AM, Ralf Prengel wrote:
Hallo, I need the information how many updates are available for a system. What is the best way to find it out in a one line bash script.
Von meinem iPad gesendet _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
-- -- Steve _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos