Question from the Bash - Fundamentals test

How to count the number of lines in a file in Bash

Hard

In the following script:

#bin/bash

counter=0

for file in ./*.txt
do
  line=$(wc -l $file | cut -d" " -f1);
  counter=$(($counter+$line))
done
echo "$counter"

What does the cut -d" " -f1 part do?

Author: titouan lecampStatus: PublishedQuestion passed 209 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!