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

Re: Counting characters in command output?



On Wed, Feb 14, 2024 at 1:46 AM Mark J. Reed <markjreed@xxxxxxxxx> wrote:
>
> On Tue, Feb 13, 2024 at 3:41 PM Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
>>
>> Process substitution gives you an array. Quote it if you need a scalar.
>
> You mean command substitution, but thanks! It wouldn't have
> occurred to me to put quotes around it to change what the `#` was
> counting!

Right, command substitution. In my opinion, it's unfortunate that
command substitution in zsh splits on IFS by default. I wish this
wasn't the case. It's not even common that one wants to split command
output into words. Lines -- perhaps, but not words. So the default
behavior in this case is rarely what is desired and has to be actively
turned off.

Roman.




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