On 6/17/25 10:31 PM, shynur . wrote:
```
INT_MAX=`echo \`printf '%u' -1\`/2 | bc`
IGNOREEOF=INT_MAX
# Then I typed C-d, bash exited...
```
```
IGNOREEOF=127
# C-d, C-d, C-d, ...
```
Why doesn’t the first piece of code work as expected?
Because it's not the right way to determine INT_MAX, and results in a
negative number.
In Bash, what exactly is the INT_MAX that I can safely use anywhere?
INT_MAX=$(getconf INT_MAX)
UINT_MAX=$(getconf UINT_MAX)
POSIX doesn't specify a way to get the max value for an intmax_t, but
you can get LONG_MAX, which is often the right value.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/