#!/bin/bash VERSION=$1 MAJRELEASE=`echo $VERSION | cut -d. -f1-2` MAJRELEASENODOT=`echo $MAJRELEASE | tr -d .` PATCHRELEASE=`echo $VERSION | cut -d. -f3` libreadline-$VERSION-patchset.patch for i in `seq 001 $PATCHRELEASE`; do PATCHRELEASEFMT=`printf "%0*d\n" 3 $i` curl -s ftp://ftp.gnu.org/gnu/readline/readline-$MAJRELEASE-patches/readline$MAJRELEASENODOT-$PATCHRELEASEFMT \ >> libreadline-$VERSION-patchset.patch || exit 1 done