LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-02-2016, 12:45 PM   #1
arry617
LQ Newbie
 
Registered: Mar 2016
Posts: 7

Rep: Reputation: Disabled
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?
 
Old 05-02-2016, 01:03 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by arry617 View Post
Any suggestions?
Which shell?
 
Old 05-02-2016, 01:06 PM   #3
arry617
LQ Newbie
 
Registered: Mar 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
bash shell
 
Old 05-02-2016, 01:40 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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.
 
  


Reply

Tags
linux, newbie, scripts



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script to ping a range or own IP-range ugurgazi Programming 13 05-02-2016 09:08 AM
Gnuplot - Combining a linear range and log-scale range in the same X-axis llauro Linux - Software 2 04-26-2011 12:55 PM
[SOLVED] What are short range link and long range links in routing? mq15 Linux - Networking 6 06-26-2009 11:16 PM
getting filesize munna_dude Programming 2 04-10-2007 01:23 AM
increasing filesize tn1681 Linux - General 1 05-01-2003 08:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration