zsh-users
 help / color / mirror / code / Atom feed
* Temporary variable compatibility
@ 2023-03-22  0:21 Felipe Contreras
  2023-03-22  1:03 ` Lawrence Velázquez
  0 siblings, 1 reply; 2+ messages in thread
From: Felipe Contreras @ 2023-03-22  0:21 UTC (permalink / raw)
  To: Zsh Users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-22  1:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22  0:21 Temporary variable compatibility Felipe Contreras
2023-03-22  1:03 ` Lawrence Velázquez

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).