Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: triviality regarding $# counts
On Sat, Apr 13, 2024, at 11:26 PM, Ray Andrews wrote:
> On 2024-04-13 17:30, Lawrence Velázquez wrote:
>> A different output method should make this clearer:
> Yes, thanks. Up till now I've basically ignored $* completely.
In a sense, you've been using it all along. Given an array "arr",
$arr is the same as $arr[*] (by default), which is why double-quoting
it produces a single word.
% arr=(a '' b 'c d' '' e)
% printf '<%s>' $arr; echo
<a><b><c d><e>
% printf '<%s>' $arr[*]; echo
<a><b><c d><e>
% printf '<%s>' $arr[@]; echo
<a><b><c d><e>
% printf '<%s>' ${(@)arr}; echo
<a><b><c d><e>
% printf '<%s>' "$arr"; echo
<a b c d e>
% printf '<%s>' "$arr[*]"; echo
<a b c d e>
% printf '<%s>' "$arr[@]"; echo
<a><><b><c d><><e>
% printf '<%s>' "${(@)arr}"; echo
<a><><b><c d><><e>
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author