Quote:
Say you have a directory of 1000 files - the question is do any three (or more) of these 1000 files have the same size.
|
For the above ... pass aruguments to the script $1,$2,$3 ... and so on
You wil know how many number of arguments passed.
Then "x1 x2 x3" in the script will be replaced by $*
ls -ltr $*
Devide sum by $# ( no of files you are passing to the script)
the remaining script will be same.
Quote:
|
Do the last three files created have the same size?
|
It is very easy to find the last three files created
Code:
ls -lt | awk '{ (if NR > 1 && NR < 5 ) print $0 }'
Hope it helps ....