5

I try:

        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 someone figure out what's wrong?

0

1 Answer 1

8

You need a space before closing test expression

while [[ $c -le $n ]]

And surround your variable with "" to avoid some painful error :

while [[ "$c" -le "$n" ]]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.