Thread (24 messages) flat view 24 messages, 2 authors, 2016-11-07

Re: [PATCH] t0021: expect more variations in the output of uniq -c

From: Johannes Sixt <hidden>
Date: 2016-11-06 21:40:10

Am 06.11.2016 um 16:31 schrieb Lars Schneider:
This looks good to me. I wonder if I should post a patch
to add the "|| return" trick to the following function
"test_cmp_exclude_clean", too?!
The function does this:

         for FILE in "$expect" "$actual"
         do
                 grep -v "IN: clean" "$FILE" >"$FILE.tmp" &&
                 mv "$FILE.tmp" "$FILE"
         done &&

It is an interesting case: If only matching lines are in the file, 
nothing would be printed, and grep returns failure. But we shouldn't 
care, because, strictly speaking, the function only wants to remove 
lines with a certain pattern. Here, it actually hurts to &&-chain grep!

It wouldn't hurt to write 'mv ... || return', but at the same time, && 
after grep should be removed.

-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help