is it a bug in bash? [[ and "$@"
by pan64 from LinuxQuestions.org on (#6N95X)
Is it a bug, undocumented or just inconsistent? $@ evaluation in [[ ]]:
Code:a=(asdfa = asdf)
[[ "${a[@]}" ]]
0
[[ "${a[@]}" =~ fg ]]
1
[[ "${a[@]}" =~ fa ]]
0
test "${a[@]}"
1
test "${a[@]}" =~ fa
bash: test: too many arguments
[ "${a[@]}" ]
1Anyway, it looks like zsh works the same way, it is intentional.
Code:a=(asdfa = asdf)
[[ "${a[@]}" ]]
0
[[ "${a[@]}" =~ fg ]]
1
[[ "${a[@]}" =~ fa ]]
0
test "${a[@]}"
1
test "${a[@]}" =~ fa
bash: test: too many arguments
[ "${a[@]}" ]
1Anyway, it looks like zsh works the same way, it is intentional.