#! /usr/bin/bash echo $'\n' printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = TITLE1="Package current version" TITLE2="Package new version" let COL=$(tput cols)-${#TITLE1} printf "%s%${COL}s" "$TITLE1" "$TITLE2" printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = echo $'\n' yum -q check-update| while read i do i=$(echo $i) if [ "${i}x" != "x" ] then UVERSION=${i#*\ } UVERSION=${UVERSION%\ *} PNAME=${i%%\ *} PNAME=${PNAME%.*} PRIMERO=`rpm -q ${PNAME} --qf '%{NAME} %{VERSION} '` let COL=$(tput cols)-${#PRIMERO} printf "%s%${COL}s" "$PRIMERO" "$UVERSION" fi done