Artificial intelligent assistant

How to find whether system is using systemd and glib specific version in shell script? I am trying to identify system using systemd and glibc version 2.17 and then run specific set of code. This is what I have come out with but i get error ./testing.sh: line 4: [[UNIT: command not found CODE: #!/bin/sh glib=`ldd --version | awk '/ldd/{print $NF}'` ver=2.17 if [[`systemctl`=~-\.mount && $glib '==' $ver ]];then echo "I have to execute certain specific stuff to glib ver 2.17" fi

Since you use the two `[[ ]]` test form, this is bash (or ksh), so :


#!/bin/bash

glib=$(ldd --version | awk '/ldd/{print $NF}')

if [[ $glib == 2.17 ]] && systemctl | grep -q '\.mount'; then
echo "I have to execute certain specific stuff to glib ver 2.17"
fi


### NOTE

* use `$( )` not `` in modern shell
* place spaces around `[[` and `]]`
* your regex try is better written with a grep

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 456893dd0e4d6f2286315f4107354ed6