[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Check if file size greater than a small number?
From: |
Dennis Williamson |
Subject: |
Re: Check if file size greater than a small number? |
Date: |
Wed, 9 Mar 2022 11:42:11 -0600 |
On Wed, Mar 9, 2022 at 11:10 AM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> https://stackoverflow.com/questions/5920333/how-can-i-check-the-size-of-a-file-using-bash
>
> I see things like the above that call an external program or cat all
> the file content to check the size of a file.
>
> But if my goal is just to know whether the file size is greater than a
> smaller (say 40). What is the most efficient way to do so in bash?
>
> --
> Regards,
> Peng
>
>
size=41
filename=testfile
read -n "$size" < "$filename"
if ((${#REPLY} >= size)) ...
--
Visit serverfault.com to get your system administration questions answered.
- Check if file size greater than a small number?, Peng Yu, 2022/03/09
- Re: Check if file size greater than a small number?,
Dennis Williamson <=
- Re: Check if file size greater than a small number?, Jesse Hathaway, 2022/03/09
- Re: Check if file size greater than a small number?, Kerin Millar, 2022/03/09
- Re: Check if file size greater than a small number?, Peng Yu, 2022/03/09
- Re: Check if file size greater than a small number?, Alex fxmbsw7 Ratchev, 2022/03/10
- Re: Check if file size greater than a small number?, Chet Ramey, 2022/03/10
- Re: Check if file size greater than a small number?, Jesse Hathaway, 2022/03/10
- Re: Check if file size greater than a small number?, Greg Wooledge, 2022/03/10
- Re: Check if file size greater than a small number?, Lawrence Velázquez, 2022/03/10