Isso quebra após 9.9.9
#!/bin/bash
version=0
subversion=0
subsubversion=1
updateVersion()
{
if [ "$subsubversion" -lt 9 ]; then
subsubversion=$((subsubversion+1));
elif [ "$subsubversion" = 9 ] && [ "$subversion" -lt 9 ]; then
subsubversion="0"; subversion=$((subversion+1));
elif [ "$subsubversion" = 9 ] && [ "$subversion" = 9 ] && [ "$version" -lt 9 ]; then
subsubversion="0"; subversion="0"; version=$((version+1));
else
echo "overflow"
fi
}
printVersion()
{
echo "${version}.${subversion}.${subsubversion}";
}
updateVersion
printVersion
Talvez prefira usar o git em vez disso?