m
m copied to clipboard
4.0 and 4.2 incorrectly identified as enterprise, $active includes "-ent"
M-C02F13KPMD6M:~ frank.snow$ mongod --version
db version v4.2.24
git version: 5e4ec1d24431fcdd28b579a024c5c801b8cde4e2
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
M-C02F13KPMD6M:~ frank.snow$ active=`mongod --version | grep "version\s*v[0-9]" | egrep -o '[0-9]+\.[0-9]+\.[0-9]+([-_\.][a-zA-Z0-9]+)?' | head -1`
M-C02F13KPMD6M:~ frank.snow$ ent=`mongod --version | egrep "(modules:\s*)|\"enterprise\"?" | wc -l`
M-C02F13KPMD6M:~ frank.snow$ echo $active
4.2.24
M-C02F13KPMD6M:~ frank.snow$ echo $ent
1
M-C02F13KPMD6M:~ frank.snow$ if [[ $ent == *1 ]]; then
> active="$active-ent"
> fi
M-C02F13KPMD6M:~ frank.snow$ echo $active
4.2.24-ent
M-C02F13KPMD6M:~ frank.snow$ m
4.0.28
4.2.24
4.4.19
5.0.15
6.0.4
Does not show active version with asterisk because $active ends with -ent.