db2 – Auomatically detect if database needs rebinding after restore?

In our deploy chain, we restore backups from our master environment and migrate the data models according to whatever branch is deployed to the target environment. Occasionally the db2level for the target environment is later than the db2level for the master environment. I would like to detect that automatically and rebind packages after restore. Currently, I’m doing something like:

currv=$(db2level | grep "Informational tokens are" | awk '{ print $5 }' | sed -e "s/",//")

bupv=$(db2ckbkp -h <bupfile> | grep "Release ID" | awk '{ print $6 }' | sed -e "s/)//")

and check if $currv is greater than $bupv. I’m not too happy with that since the text I’m grepping for may change in future releases (as an example).

Does anyone have a neater way of doing this?