[ `uname -r` =~ ^4\.4.*$ ] && echo "yes"
which is, however, unsuccessful in all cases.
uname -r command gives things like
4.6.0-040600-generic as an output.
[ may not be what you are looking for; however,
[[ does support
=~. Try this:
[[ $(uname -r) =~ ^4\.4 ]] && echo yes
Depending on your use case (e.g.testing multiple values), you might find the "case" syntax a better fit.
case $(uname -r) in 4.4*) echo 4.4 based kernel found ;; 3.10*) echo 3.10 based kernel found ;; *) echo unknown kernel found esac
ver=$(cut -d. -f1-2 <(uname -r)) [[ $ver =~ 3.2 ]] && echo "y"
ver=$(cut -d. -f1-2 <(uname -r)) [ $ver == 3.2 ] && echo "y"
case $(uname -r) in (4.4.*) echo yes;; esac