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

Re: Strange behavior with "for i in .."



Volodya Khomchak wrote:
> I faced with strange behavior with "for i in ..".
> So the problem is next:
>    # for i in /etc/profile.d/*.sh;do echo $i;done
>    # zsh: bad math expression: operand expected at `/etc/profi...'

the i variable has somewhere been declared as an integer type. For
example with a command such as:
  typeset -i i
or more likely in a math expression such as:
  (( i = 1 ))

You can verify this by doing:
  typeset -p i
or if you prefer:
  echo ${(t)i}

You can use typeset +i i to remove the integer type. However, you may
want to check where it is being set. There might be a shell function
that should have declared i local.

Oliver



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