While loop breaks in bash script if i call Vimdiff within loop

432 views Asked by At

I am trying to use vimdiff of two files within while loop. But it breaks after 1st loop.

while read line
do
vimdiff -c TOhtml -c wqa! $line"_file1" $line"_file2"
done < inpFile.txt

Though inpFile contains multiple entries, the above loop breaks after 1st loop. I suspect if its because of subprocess. May i know how to get it running for all entries in file.

1

There are 1 answers

0
that other guy On BEST ANSWER

Redirect so that vimdiff doesn't eat the input intended for the loop:

while read line
do
    vimdiff -c TOhtml -c wqa! $line"_file1" $line"_file2"  < /dev/null
done < inpFile.txt