view bin/cdb_chain.sh @ 306:2bed05d3e158 trim

get rm in loop in right place, ensure unique pipe names
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Sat, 17 May 2025 11:12:46 +0100
parents 3bd6378eb64e
children
line wrap: on
line source

#!/usr/bin/bash
# Chain together n steps of test_cdbp 
# Usage cdb_chain n
# First step takes stdin, intermediate steps use FIFOs, last step goes to stdout
export PYTHONPATH=~/lib/python/cc/lmh
n=$1
mkdir -p /tmp/hst
me=/tmp/hst/$$
mkfifo ${me}_from0
cat | { cdbp.sh 0 > ${me}_from0 ; } &
seq 1 $((n - 2)) | while read i ; do
 mkfifo ${me}_from$i
 { cdbp.sh $i < ${me}_from$((i - 1)) > ${me}_from$i ;  rm ${me}_from$((i - 1)) ; } &
done
cdbp.sh $((n - 1)) < ${me}_from$((n - 2))
rm ${me}_from$((n - 2))