annotate bin/cdb_chain.sh @ 353:6b1137bdbd0d trim

give access to block offsets via callback
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 16 Mar 2026 10:43:01 +0000
parents 2bed05d3e158
children 1ff1bbf30472
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
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
3 # Usage cdb_chain n
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
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
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
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
diff changeset
13 { cdbp.sh $i < ${me}_from$((i - 1)) > ${me}_from$i ; rm ${me}_from$((i - 1)) ; } &
281
25d49e1f6c1d automate a cdb chain
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
14 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
15 cdbp.sh $((n - 1)) < ${me}_from$((n - 2))
2bed05d3e158 get rm in loop in right place, ensure unique pipe names
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 305
diff changeset
16 rm ${me}_from$((n - 2))