#!/usr/bin/env bash # Assumes pacakages are from webtatic, might need to adjust for other repos # @webtatic packages look like this: # php71w-common.x86_64 7.1.7-1.w7 @webtatic versionFrom=70 versionTo=71 yum list installed | grep php | grep $versionFrom > /tmp/php_installed yum -y remove 'php*' while read -r line; do echo $line; package=$(echo $line | cut -d ' ' -f 1 | sed "s/$versionFrom/$versionTo/g"); echo $package; yum -y install $package done < /tmp/php_installed