zsh-users
 help / color / mirror / code / Atom feed
* Is this possible in ZSH?
@ 2010-11-14 13:12 nix
  2010-11-14 20:10 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: nix @ 2010-11-14 13:12 UTC (permalink / raw)
  To: zsh-users

Hi.
#!/bin/zsh

[CODE]

zmodload zsh/terminfo
emulate zsh

function Echo () {

# This function simulates background process that executes in a random period

#local A
#local B

A=$1
B=$2

sleep $B

echo "Key: $A Value: $B"
}

A=0
RANGE=15

while [ $A -lt 4 ] ; do

Rnd=$RANDOM
let "Rnd %= $RANGE"

# - Fork

Echo $A $Rnd & # <-----------
let "A++"

done

wait

[/CODE]

Is it possible to append background process results to a variable or to an
array without waiting for that job to finish? So as soon as "Echo"
function finishes, it´s results would be appended instead of file to
variable. I have tried it but every time it waited for the process until
it finished and i lost my multi-threading.





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

end of thread, other threads:[~2010-11-14 22:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-14 13:12 Is this possible in ZSH? nix
2010-11-14 20:10 ` Bart Schaefer
2010-11-14 22:01   ` nix

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).