Question: I would like to call a Python script from within a Bash while loop. However, I do not understand very well how to use appropriately the while loop (and maybe variable) syntax of the Bash. The behaviour I am looking for is that, while a file still contains lines (DNA sequences), I am calling a Python script to extract groups of sequences so that another program (dialign2) can align them. Finally, I add the alignments to a result file. Note: I am not trying to iterate over the file. What should I change in order for the Bash while loop to work? I also want to be sure that the while loop will re-check the changing file.txt on each loop. Here is my attempt:

```
#!/bin/bash
# Call a python script as many times as needed to treat a text file

c=1
while [ `wc -l file.txt` > 0 ] ; # Stop when file.txt has no more lines
do
    echo "Python script called $c times"
    python script.py # Uses file.txt and removes lines from it
    # The Python script also returns a temp.txt file containing DNA sequences
    c=$c + 1
    dialign -f temp.txt # aligns DNA sequences
    cat temp.fa >>results.txt # append DNA alignements to result file
done

```

Thanks!

Answer: 
No idea why you want to do this.

```
c=1
while [[ -s file.txt ]] ; # Stop when file.txt has no more lines
do
    echo "Python script called $c times"
    python script.py # Uses file.txt and removes lines from it
    c=$(($c + 1))
done

```
try `-gt` to eliminate the shell metacharacter `>`

```
while [ `wc -l  file.txt`  -gt 0 ]
do
    ...
    c=$[c + 1]
done

```