view bin/cdb_chain.sh @ 366:1ff1bbf30472 plus

got the full chain running
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 08 Apr 2026 13:51:00 +0100
parents 2bed05d3e158
children
line wrap: on
line source

#!/usr/bin/bash
# Chain together n steps of test_cdbp 
# Usage cdb_chain.sh 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))
  #echo f$((i - 1)) ended 1>&2
 } &
done
cdbp.sh $((n - 1)) < ${me}_from$((n - 2))
#echo f$((n - 2)) ended 1>&2
rm ${me}_from$((n - 2))