Bash
-
Initialisation section:
-
Execute command for each line:
Can be also used with
done < input.out -
Loop through array items:
-
named pipes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28#!/usr/bin/env bash # remove previous named pipe rm -f pipe || true # create a named pipe mknod pipe p # open a file for reading and writing # save it's file descriptor to variable $fd exec {fd}<>pipe client() { local name=$1 while true; do sleep 3 echo "[client ${name}] hi" >&$fd done } client one & client two & client three & while read -r -u "$fd" line; do echo "[read line] ${line}" done