On 2024-01-29 20:17, Ray Andrews wrote:
On 2024-01-29 20:06, Bart Schaefer wrote:On Mon, Jan 29, 2024 at 8:04 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:So, something has declared "bb" to be an integer.Or a float, or some other numeric type, they all produce that error.Right you are. Yeah, some careless use of the variable, I didn't bother to declare it local so it's some stray coming from somewhere else. I hate that. Orphaned variables hanging around waiting to get into trouble. I'll track down the leak. Thank you Sensei.
BTW Bart, just a post mortem on that: I know there are situations where a plain vanilla scalar is promoted to integer when the situation requires it. In the above, I wonder about an automatic demotion. The situation plainly had nothing to do with arithmetic OTOH perhaps there could be situations where a for loop like that one really would be doing arithmetic there in which case type assumptions would be unwise. OTOOH perhaps automatic 'non demotion' would be possible -- zsh might have robust defenses against making a mistake. Dunno, but as dangerous as 'obvious' can be, it seems to me that a glob expansion of a bunch of filenames is obviously nothing to do with arithmetic.
3 /aWorking/Zsh/Source/Wk 0 % var=abc; var=$(( 1+1 )); echo $var 2 for bb in *.eml~save*; do... just as var can be automatically turned into an integer so to perhaps bb could be clearly understood to be scalar in that situation. Again, unless I really might have intended something mathematical there which is hard to imagine.