Adding a bit to @tgdavies comment:
After mvn release:prepare, the settings are stored in a file called release.properties. The version is stored in a line having the form project.rel.<groupId>:<artifactId>=<version>. Assuming group and artifact ids should be ignored. Using grep the line can be extracted using
grep -E '^project.rel\..*=' release.properties
And cut or awk can be used to extract the version. Combined it gives:
grep -E '^project.rel\..*=' release.properties | cut -d'=' -f2