Remove leading 0's
This uses extended globbing. More of that [http://mywiki.wooledge.org/glob#extglob here]. Also see BashExtendedGlobs. To enable this:
shopt -s extglob
and then
A="00123"
B=${A##+(0)} # B := 123
Here the ## means remove longest match, and +(0) means match 1 or more 0's.
Related example:
A="abababacde"
B="${A##+(ab)}" # B := acde