The function detect_host_os is not working because it returns multiple lines from file /etc/os-release.
Below are first couple of lines from the file on Ubuntu 20.04 server:
With this content, the function will return two lines, ID= and ID_LIKE.
However, by making the grep command look for ID= the function will return only one line:
_os=$(grep "^ID=" /etc/os-release | sed -e 's/^ID=//')
The function
detect_host_os
is not working because it returns multiple lines from file/etc/os-release
. Below are first couple of lines from the file on Ubuntu 20.04 server:With this content, the function will return two lines,
ID=
andID_LIKE
. However, by making the grep command look forID=
the function will return only one line: