While emulating ksh-88 with zsh, assigning non integer value to integer variable is not considered as an error

Solution Verified - Updated -

Issue

Anything assigned to integer variable is considered as an arithmetic expression.

zsh> integer x
zsh> x=1
zsh> echo $?

zsh> x=two
zsh> echo $?

zsh> echo $x

zsh> two=2
zsh> x=two
zsh> echo $?

zsh> echo $x
2

Environment

  • Red Hat Enterprise Linux

  • zsh

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.