I know I am asking questions a bit close together, but I can't seem to figure this out.
I have the following code:
currentver="$(lsb_release -rs)"
requiredver="18.04"
if ["$(printf '%s\n' "$requiredver" "$currentver" | sort -V | head - n1)" = "$requiredver"]
then
read -p "Ubuntu?: " vari
else
read -p 'Hello?: ' var
fi
However, I always get this error: ./test.sh: line 3: [18.04: command not found
. I've tried comparing currentver
with 18.04
as comparing numbers, I've tried comparing them as strings, but nothing seems to work!
Any help is (as always) greatly appreciated.
Just need spaces at either end of the if statement:
whoops