bug#70860: Add an option to remove filenames for wc util

Laurent Lyaudet <[email protected]> Fri, 17 Apr 2026 19:20:23 +0200
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <CAB1LBmtFfH+8h-UgcyhQj7F8Sc38eZ0_HmV7vMJ2ri-_fCvWUQ@mail.gmail.com>
Le ven. 17 avr. 2026 à 19:15, Paul Eggert <[email protected]> a écrit :
>
> On 2026-04-17 10:03, Laurent Lyaudet wrote:
>
> >>     for file in *; do
> >>       lines=$(wc -l <"$file") &&
> >>       printf '"%s" contains %d lines\n' "$file" $lines
> >>     done
> >
> > VS
> >
> > lines=$(wc -ln "$file")
>
> Not a fair comparison. The fair comparison is:
>
> lines=$(wc -ln "$file")
>
> versus:
>
> lines=$(wc -l <"$file")
>
Still not a fair comparison.
A fair comparison can be:
> >>     for file in "${files[@]}"; do
> >>       lines=$(wc -l <"$file") &&
> >>       printf '"%s" contains %d lines\n' "$file" $lines
> >>     done
versus:
lines=$(wc -ln -- "${files[@]}")