zsh-users
 help / color / mirror / code / Atom feed
* piping surprise
@ 2024-04-03 13:17 Ray Andrews
  2024-04-03 15:00 ` Mikael Magnusson
  0 siblings, 1 reply; 6+ messages in thread
From: Ray Andrews @ 2024-04-03 13:17 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

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?



[-- Attachment #2: Type: text/html, Size: 1292 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-07  6:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03 13:17 piping surprise Ray Andrews
2024-04-03 15:00 ` Mikael Magnusson
2024-04-03 15:49   ` Ray Andrews
2024-04-05 20:32     ` Bart Schaefer
2024-04-05 23:11       ` Ray Andrews
2024-04-07  6:34       ` Lawrence Velázquez

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).