bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
echo "BASH VERSION --- $BASH_VERSION"
echo "bmajor ----- $bmajor"
echo "bminor ----- $bminor"
prints,
BASH VERSION --- 4.2.46(1)-release
bash --- 4.2
bmajor ----- 4
bminor ----- 2
I normally use curly brackets, {} to work with arrays. I see here, they are used for pattern matching.
How these values, ${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} are evaluated? And what does the special characters, *, ., # inside {} mean?