[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Integer Overflow in braces
From: |
Greg Wooledge |
Subject: |
Re: Integer Overflow in braces |
Date: |
Mon, 17 Aug 2015 08:20:26 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Sat, Aug 15, 2015 at 08:53:55PM -0700, Pasha K wrote:
> (gdb) r -c "for x in {1..9223372036854775805}; do echo overflow; done"
Brace expansion requires bash to generate and store ALL of those strings
in memory simultaneously. I seriously doubt any computer on earth has
enough virtual memory to hold what you've asked for here. (Unless I'm
miscounting, you've asked bash to generate over 900 quintillion strings
of length varying from 1 to 19 bytes in length (2 to 20 with NULs).)
If you want to count to a large number, use a C-style for loop instead
of a brace expansion.
for ((x=1; x<=9000000000; x++)); do ...; done
- Integer Overflow in braces, Pasha K, 2015/08/16
- Re: Integer Overflow in braces,
Greg Wooledge <=
- Re: Integer Overflow in braces, Pasha K, 2015/08/17
- Re: Integer Overflow in braces, Eric Blake, 2015/08/18
- Re: Integer Overflow in braces, John McKown, 2015/08/18
- Re: Integer Overflow in braces, Dan Douglas, 2015/08/18
- Re: Integer Overflow in braces, Greg Wooledge, 2015/08/18
- Re: Integer Overflow in braces, Dan Douglas, 2015/08/18
- Re: Integer Overflow in braces, Chet Ramey, 2015/08/18
- Re: Integer Overflow in braces, Eduardo A . Bustamante López, 2015/08/20