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

Is this possible in ZSH?



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.






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