Project

General

Profile

1
#!/bin/sh
2
# Transforms a map spreadsheet to use a different root, using a connecting root
3
# that links the input and output roots together.
4
# Warning: ch_root_via is usually *not* an idempotent operation.
5
# Only the re-rooting step is idempotent.
6

    
7
selfDir="$(dirname -- "$0")"
8

    
9
if test -z "${left_connect+t}" -o -z "${right_connect+t}"; then
10
    echo "Usage: env ch_root_opts... left_connect=... right_connect=... $0 \
11
<in_map >out_map" >&2
12
    exit 2
13
fi
14

    
15
env \
16
left_out_root="$left_connect" \
17
right_out_root="$right_connect" \
18
"$selfDir/ch_root"\
19
|env \
20
left_in_root="$left_out_root" \
21
right_in_root="$right_out_root" \
22
"$selfDir/ch_root"
23
# replace the root with the connector, and then re-root as the out_root
(7-7/82)