[Libreoffice] Test script patch review request (1)

Tor Lillqvist tlillqvist at novell.com
Tue Jan 4 03:07:57 PST 2011


Eek, I wrote:

> while read fn </tmp/tabs.auto.filelist.txt; do
>     sed 's/	/    /g' < $fn > /tmp/notabfile
>     mv /tmp/notabfile $fn
> done

But that is wrong... it will read the first line from file line over and over again, it seems. The correct syntax  would be:

while read fn; do
    sed 's/	/    /g' < $fn > /tmp/notabfile
    mv /tmp/notabfile $fn
done </tmp/tabs.auto.filelist.txt

/me blushes.

I admit that having to have the redirection of input to the while loop at the end, after the "done", does make it harder to read, especially if the loop is long. In this case the loop is not long, but still... so yeah, using "cat" here to pipe the file into the while loop is clearer, even if it introduces an extra process and pipe.

--tml




More information about the LibreOffice mailing list