Conditional expression syntax error

I'm trying to:

        while [[ $c -le $n]]
        do
        now=$(date +"%T")
        echo "Tps at :- $now"
        @c=$c+1
        done

I got:

   syntax error in conditional expression

   syntax error near `do'

Can anyone figure out what happened?

+5
source share
1 answer

You need space before closing the test expression

while [[ $c -le $n ]]

And surround the variable "" to avoid any painful mistake:

while [[ "$c" -le "$n" ]]
+8
source

All Articles