I had trouble using chepner's answer while using variables. Instead I ended up using the following:
$ version="15.12" $ major="${version%%.*}" $ echo "$major" 15