0

code:

if [ $mintemp -ge 15 && $maxtemp -le 28 ]; then echo "nice day"; fi

I already have spaces between [ and $Mintemp , 28 and ]

but the error still happend

1 Answers1

2

&& is not a [] argument (since [ is actually a program), it is Bash's operator for running second command if the first one succeeds. So for bash your script looks like:

if ([ $mintemp -ge 15) && ($maxtemp -le 28 ]; then echo "nice day"; fi)

Which is invalid. You can however do it like:

if [ $mintemp -ge 15 ] && [ $maxtemp -le 28 ]; then echo "nice day"; fi