I gone through single line inifinite while loop in bash, and trying to add a single line while loop with condition. Below I have mentioned my command, which gives unexpected result (It is suppose to stop after 2 iterations, but it never stops. And also it considers variable I as executable).
Command:
i=0; while [ $i -lt 2 ]; do echo "hi"; sleep 1; i = $i + 1; done
Output:
hi
The program 'i' is currently not installed. To run 'i' please ....
hi
The program 'i' is currently not installed. To run 'i' please ....
hi
The program 'i' is currently not installed. To run 'i' please ....
...
...
Note: I am running it on Ubuntu 14.04