#!/usr/bin/env bash
set -euo pipefail
cmds=$1
shift
args=("$@")
set -- $cmds
cmd=$1
shift
$cmd "${args[@]}" | tee index.txt | while read line
do
	if [ "$#" -gt 0 ]
	then
		mkdir "$line"
		pushd "$line"
		mkres "$*" "${args[@]}" "$line"
		popd
	fi
done
