Re: Strange infinite loop by a very specific syntax error in PS1
From:
Chet Ramey
Subject:
Re: Strange infinite loop by a very specific syntax error in PS1
Date:
Thu, 7 Aug 2025 12:30:32 -0400
User-agent:
Mozilla Thunderbird
On 8/7/25 3:50 AM, smart.outfit080@8shield.net wrote:
2. Run this:
PS1+='${-:$((.))}'
3. Now it loops the following error message:
bash: .: syntax error: operand expected (error token is ".")
Thanks for the report. The continuous attempts to expand $PS1 aside,
you'll never be able to use floating point arithmetic in $((expr))
expansions.
The problem is that the PS1 expansion failure causes bash to abandon
the current command, and try to go back to the top level and prompt
again, at which point the PS1 expansion failure occurs again. I'll
fix this in the devel branch.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/