1
Code:
for i in `find $1 -name $4 -type f` ; do
path=`readlink -f $4`
words=`cat "$i" | wc -w`
echo "$path: $words palavras"
done
Prints:
/home/miglui/Desktop/SO/teste.txt: 14 palavras
/home/miglui/Desktop/SO/teste.txt: 48 palavras
/home/miglui/Desktop/SO/teste.txt: 29 palavras
Should Print:
/home/miglui/Desktop/SO/teste/1/teste.txt: 14 palavras
/home/miglui/Desktop/SO/teste/2/teste.txt: 48 palavras
/home/miglui/Desktop/SO/teste/teste.txt: 29 palavras
The source is not printing the entire file path. Where the error may be?
pq vc does not ``path=`pwd $4```?
– Lucas Virgili
@Lucas-Virgili Why you have to show the file name at the end of the path.
– Miguel Luís