Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
piping surprise
- X-seq: zsh-users 29775
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: piping surprise
- Date: Wed, 3 Apr 2024 06:17:14 -0700
- Archived-at: <https://zsh.org/users/29775>
- List-id: <zsh-users.zsh.org>
Speaking of female logic, I stumbled upon
this:
function bbb ()
{
vvar=4
print -l "\nShall\nI\ncompare thee\nto a\nsummer's day?"
}
function aaa ()
{
local vvar=1
bbb
echo "\nvvar is $vvar"
vvar=2
echo "\n=============\n"
bbb | grep 'a'
echo "\nvvar is $vvar"
}
% aaa
Shall
I
compare thee
to a
summer's day?
vvar is 4
=============
Shall
compare thee
to a
summer's day?
vvar is 2
------------------------------------------------------------------
By what thinking does the piping of a function's output thru grep
cancel the assignment to the variable? Do we really want that?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author