#!/bin/bash
. init

cd $tex

for i in *
do
if [ -d $i ]
then
	echo $i
	cd $i

	( echo '\input pisne'
	echo "\\def\\adresar{$i}"
	ls *.tex|while read jm
	do if [ $jm != index.tex ]
	then
		echo '\input '$jm
	fi; done
	echo '\bye' )>index.tex

	cd ..
fi
done
