Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Counting characters in command output?



On Wed, Feb 14, 2024, at 11:30 AM, Ray Andrews wrote:
> So really there is a logical problem too.  We have another 'invisible' 
> transformation.  We 'have' quarts but liters are what's counted, yes?  
>
>> I would in general have expected *foo $(bar) * to behave identically to *baz=$(bar); foo $baz*.
>
> Yes, it would be non-negotiable in algebra.  a=b; b=c; ergo a=c.

The shell language isn't algebra.  This is hardly the only case in
which the substitution principle doesn't hold without putting in
some extra work (which I'm omitting here for demonstration purposes).

	% foo=(a b c)
	% printf '<%s>' $foo; echo
	<a><b><c>
	% bar=$foo
	% printf '<%s>' $bar; echo
	<a b c>

-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author