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

Temporary variable compatibility



Hi,

I found a discrepancy between different shells:

  f() { echo $var; }
  var=1 f
  test -z "${var-}"

Both zsh, bash, and dash set the variable temporarily, but ksh does not.

In zsh the emulation of ksh and sh both keep the variable assignment.

Is this the POSIX standard? If so, then how should one temporarily set
a variable? A subshell?

Cheers.

-- 
Felipe Contreras




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