Determine xcode command line tools version

Finding the CLI version number depends on the combination of which particular OS and which particular CLI Tools are installed. One of these should work:

On Yosemite & Mavericks:

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

on Mountain Lion:

pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI

For versions of macOS X 10.9 Mavericks and later, this code will provide you the version of both Xcode and Command Line Tools for Xcode, if either are installed:

# Xcode
if pkgutil --pkgs=com.apple.pkg.Xcode >/dev/null; then
    echo Xcode: $(pkgutil --pkg-info=com.apple.pkg.Xcode | awk '/version:/ {print $2}')
else
    echo Xcode: not installed
fi

# Command Line Tools for Xcode
if pkgutil --pkgs=com.apple.pkg.CLTools_Executables >/dev/null; then
    echo CommandLineTools: $(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | awk '/version:/ {print $2}')
else
    echo CommandLineTools: not installed
fi