Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

for x in * evaluates filenames as arithmetic expressions?



When executed in a directory containing files with names such as

	2004-10-22.txt
	2004-10-29.txt
	...

a ZSH command of

	for x in *
	do
		echo $x
	done

fails with

	zsh: bad math expression: operator expected at `txt'

Thus, it appears that the wildcard is erroneously evaluated as arithmetic 
expression. This is confirmed by

	for x in 9-5
	do
		echo $x
	done

, which outputs
	
	4

This behavior differs significantly from that of other shells. Is there any 
way to turn it off? So far, the only way I have found to process such 
directories is to use BASH instead of ZSH.

Any hints are appreciated,
  Andreas Koch



Messages sorted by: Reverse Date, Date, Thread, Author