While loop condition in shell script
问题 I have a text file called file.txt that has below entries :- healthy healthy healthy healthy healthy unhealthy initial healthy initial healthy Now i do a count of the number of healthy , initial and unhealthy in this file using below command :- grep -c healthy file.txt grep -c unhealthy file.txt grep -c initial file.txt Now i want a loop condition in shell script that does this for me :- while [ $(grep -c "healthy" file.txt) -lt 6 -a $(grep -c "unhealthy" file.txt) != 0 -a $(grep -c "initial"