zsh-workers
 help / color / mirror / code / Atom feed
* Inconsistent behavior of the test command with associative arrays
@ 2024-04-17 21:37 limited time
  2024-04-17 22:13 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: limited time @ 2024-04-17 21:37 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

% zsh -f
% typeset -A array=(key1 value1 key2 value2);
test $array[key1] ; echo $? ;
test $array[key2] ; echo $? ;
test $array[key3] ; echo $? ;
test $array[key4] ; echo $? ;
if test $array[key1] -a $array[key2] ; then
  echo "Condition evaluated to true" ;
fi                                             
if test $array[key3] -a $array[key4] ; then             
  echo "Condition evaluated to true" ;
fi
0
0
1
1
Condition evaluated to true
Condition evaluated to true

[-- Attachment #2: Type: text/html, Size: 1216 bytes --]

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

end of thread, other threads:[~2024-04-17 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 21:37 Inconsistent behavior of the test command with associative arrays limited time
2024-04-17 22:13 ` Bart Schaefer

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).