LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Range for filesize in ls -l (https://www.linuxquestions.org/questions/linux-newbie-8/range-for-filesize-in-ls-l-4175578836/)

arry617 05-02-2016 12:45 PM

Range for filesize in ls -l
 
I am trying to display the files whos sizes are in a specific range. This script will take two arguments as the lower bound and upper bound of the file size, and prints out a list of filenames and their sizes. I tried this:

for i in {$0..$1}
do
set -- $(ls -l "$i")
echo $i: $5 bytes
done

I'm pretty sure I'm implementing the range incorrectly, but I don't know how to make it work. Any suggestions?

Habitual 05-02-2016 01:03 PM

Quote:

Originally Posted by arry617 (Post 5539605)
Any suggestions?

Which shell?

arry617 05-02-2016 01:06 PM

bash shell

grail 05-02-2016 01:40 PM

As this is an extension of your other question (which you have not marked as SOLVED), you should ask it there as people are already trying to help you.


All times are GMT -5. The time now is 06:30 PM.