What’s the purpose of the script below?
#!/bin/bash
read -p "Enter the directory path: " DIR
read -p "Enter the file extension (e.g. txt, csv): " EXT
for file in "$DIR"/*."$EXT"; do
lines=$(wc -l < "$file")
echo "$file: $lines lines"
done
What’s the purpose of the script below?
#!/bin/bash
read -p "Enter the directory path: " DIR
read -p "Enter the file extension (e.g. txt, csv): " EXT
for file in "$DIR"/*."$EXT"; do
lines=$(wc -l < "$file")
echo "$file: $lines lines"
done