From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27066 invoked by alias); 14 Nov 2010 13:19:24 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15543 Received: (qmail 14083 invoked from network); 14 Nov 2010 13:19:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at myproxylists.com does not designate permitted sender hosts) X-Originating-IP: 127.0.0.1 Message-ID: Date: Sun, 14 Nov 2010 15:12:25 +0200 Subject: Is this possible in ZSH? From: nix@myproxylists.com To: zsh-users@zsh.org User-Agent: SquirrelMail/1.4.20 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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.