Skip to content

Instantly share code, notes, and snippets.

@mtholder
Created December 31, 2019 17:42
Show Gist options
  • Select an option

  • Save mtholder/b81a63cdec5fc3a8f1cd9461beee4e20 to your computer and use it in GitHub Desktop.

Select an option

Save mtholder/b81a63cdec5fc3a8f1cd9461beee4e20 to your computer and use it in GitHub Desktop.
script to populate a reversed_subproblems subdirectory in a synth tree build.
#!/bin/bash
inpdir=$1
if ! test -d "${inpdir}" ; then
echo "$0 must be passed in a directory of subproblems (with ott###.tre files)."
exit 1
fi
rpwd=`realpath .`
rpid=`realpath $inpdir`
if test "${rpwd}" = "${rpid}" ; then
echo "$0 Cannot be run in place."
exit 1
fi
for i in `ls "${inpdir}"/ott*.tre` ; do
bn=`basename "$i"`
stem=`echo $bn | sed -E 's/.tre$//'`
tnf="${inpdir}/${stem}-tree-names.txt"
./gen_reversed.py "${i}" > "${bn}"
if test -f "${tnf}" ; then
./gen_reversed.py "${tnf}" > "${stem}-tree-names.txt"
fi
echo $stem
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment