#! /bin/sh
# for do done
dest=/home/douillet/docs/Nullix/batchix_00.lyx
echo "" > $dest
cat <<EOF >> $dest
#LyX 1.1 created this file.
\\lyxformat 218
\\textclass article
\\language english
\\inputencoding auto
\\fontscheme default
\\graphics default
\\paperfontsize default
\\spacing single
\\papersize Default
\\paperpackage a4
\\use_geometry 1
\\use_amsmath 0
\\paperorientation portrait
\\leftmargin 1in
\\topmargin 1in
\\rightmargin 1in
\\bottommargin 1in
\\secnumdepth 3
\\tocdepth 3
\\paragraph_separation indent
\\defskip medskip
\\quotes_language english
\\quotes_times 2
\\papercolumns 1
\\papersides 1
\\paperpagestyle default
\\layout Title
Batches en tous genres
\\layout Date
`date`
\\layout Standard
\\begin_inset LatexCommand \\tableofcontents{}
\\end_inset
\\layout Standard
EOF
cd /home/douillet/bin
#-----------------------------------------
cat <<EOF >> $dest
\\layout Section
Batches génériques
\\layout Standard
EOF
#-----------------------------------------
for i in `find * -type f -maxdepth 0 -perm 700 | sed -e "/^sed/ d ; /\.lyx/ d ; /\~/ d "`
do
if test "`grep douillet $i`"
then continue
fi
echo $i
cat << EOF >> $dest
\\layout Subsection
$i
\\layout Standard
\\begin_inset Include \\verbatiminput{/home/douillet/bin/$i}
\\end_inset
EOF
done
#-----------------------------------------
cat <<EOF >> $dest
\\layout Section
Batches spécifiques
\\layout Standard
EOF
#-----------------------------------------
for i in `find * -type f -maxdepth 0 -perm 700 | sed -e "/^sed/ d ; /\.lyx/ d ; /\~/ d "`
do
if ! test "`grep douillet $i`"
then continue
fi
echo $i
cat << EOF >> $dest
\\layout Subsection
$i
\\layout Standard
\\begin_inset Include \\verbatiminput{/home/douillet/bin/$i}
\\end_inset
EOF
done
echo \\the_end >> $dest
lyx $dest