#! /bin/sh prefix=rc7. suffix= commit=ec5a2ef5 [ -n "$suffix" ] || suffix=$2 while [ "$suffix" != "${suffix#[^0-9]*.}" ]; do suffix=${suffix#[^0-9]*.} done echo $prefix$suffix${commit:+_}$commit