#!/bin/bash # Strip cat, we only need the pkg name pearpkg="`echo ${1} | sed -e "s|^.*/||g"`" # Take care of some strange package naming pearpkg="${pearpkg/PEAR-/}" # Take care of outputting the version number pwd="`pwd`" if ! test -d "${pwd}/${pearpkg}-tmp" ; then mkdir "${pwd}/${pearpkg}-tmp" fi cd "${pwd}/${pearpkg}-tmp" wget --quiet --tries=1 --timeout=3 "http://pear.php.net/feeds/pkg_${pearpkg}.rss" grep -i title pkg_${pearpkg}.rss | sed -e "s|||g" | sed -e "s|||g" | head -n 2 | tail -n 1 | awk '{print $NF}' rm -Rf "${pwd}/${pearpkg}-tmp"