annotate bin/cdb_chain.sh @ 392:faad1c51c289 plus

part 4 == body for RESP working
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 22 Jun 2026 16:00:02 +0100
parents 1ff1bbf30472
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
281
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
1 #!/usr/bin/bash
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
2 # Chain together n steps of test_cdbp
366
1ff1bbf30472 got the full chain running
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 306
diff changeset
3 # Usage cdb_chain.sh n
281
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
4 # First step takes stdin, intermediate steps use FIFOs, last step goes to stdout
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
5 export PYTHONPATH=~/lib/python/cc/lmh
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
6 n=$1
306
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
diff changeset
7 mkdir -p /tmp/hst
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
diff changeset
8 me=/tmp/hst/$$
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
diff changeset
9 mkfifo ${me}_from0
366
1ff1bbf30472 got the full chain running
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 306
diff changeset
10 cat | { cdbp.sh 0 > ${me}_from0 ;} &
281
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
11 seq 1 $((n - 2)) | while read i ; do
306
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
diff changeset
12 mkfifo ${me}_from$i
366
1ff1bbf30472 got the full chain running
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 306
diff changeset
13 { cdbp.sh $i < ${me}_from$((i - 1)) > ${me}_from$i ; rm ${me}_from$((i - 1))
1ff1bbf30472 got the full chain running
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 306
diff changeset
14 #echo f$((i - 1)) ended 1>&2
1ff1bbf30472 got the full chain running
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 306
diff changeset
15 } &
281
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
16 done
306
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
diff changeset
17 cdbp.sh $((n - 1)) < ${me}_from$((n - 2))
366
1ff1bbf30472 got the full chain running
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 306
diff changeset
18 #echo f$((n - 2)) ended 1>&2
306
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
diff changeset
19 rm ${me}_from$((n - 2))