As practice I need to complete a script that orders all filles by size with a given extension(.txt for example) including those in subdirectories too.
For example; ./ex1.sh einstein txt einstein/copyright.txt einstein/do-how.txt einstein/etext9/bil11.txt einstein/etext9/2ws271.txt einstein/etext9/liber11.txt einstein/etext0/bib0010h/Readme.txt einstein/etext0/kknta10.txt
I can't use du or other advanced commands. At some point I need to use find, I tried something like this
find -depth - type f -name "*.$extension" | sort ....
but this hasn't work really well, as i don't really know how to sort them by size, only result i get is sorted by name.
I was looking for an output similar to ls -lhS but including subdirectories.