0

Open new Terminal and count 1 to 10 within it.

terminal -e "for i in {1..10}; do echo $i; sleep 1; done;"

result:

  3
  3
  3
  3
  3...

why is it doing that ?

5

Because of double quotes - they make variables to be interpreted in current shell, the one that executes terminal command. You got 3 apparently for the reason your $i is defined in your shell so before. Use single quotes to get expected result.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy