Re: IGNOREEOF is ineffective when holds a big integer
From:
Greg Wooledge
Subject:
Re: IGNOREEOF is ineffective when holds a big integer
Date:
Tue, 17 Jun 2025 23:07:31 -0400
User-agent:
Mutt/1.10.1 (2018-07-13)
On Wed, Jun 18, 2025 at 02:31:06 +0000, shynur . wrote:
> ```
> INT_MAX=`echo \`printf '%u' -1\`/2 | bc`
> IGNOREEOF=INT_MAX
> # Then I typed C-d, bash exited...
> ```
You probably meant to type $INT_MAX there, not INT_MAX. You assigned
a string to the IGNOREEOF variable, not a number. According to the man
page, this means it should use the default value of 10.
> ```
> IGNOREEOF=127
> # C-d, C-d, C-d, ...
> ```
>
> Why doesn’t the first piece of code work as expected?
You mean, why didn't it require 10 Ctrl-d's? I have no idea.
> In Bash, what exactly is the INT_MAX that I can safely use anywhere?
Bash versions 2.05b and higher use 64-bit integers for almost everything,
on almost(?) all platforms.
This feels like an X-Y problem, though. What are you really trying to
do here?