Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Temporary variable compatibility
- X-seq: zsh-users 28979
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Temporary variable compatibility
- Date: Tue, 21 Mar 2023 18:21:14 -0600
- Archived-at: <https://zsh.org/users/28979>
- List-id: <zsh-users.zsh.org>
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