#!/bin/bash

input_dir=/usr/share/doc
output_file=/usr/share/doc/index.html

cat > $output_file << EOF
<html>
<head>
<title>$input_dir</title>
</head>
<body>
EOF

find $input_dir -iname 'index.html' | \
sed 's/[^ ]*/\<br\>\<a href="file:&"\>&\<\/a\>/' | \
sort >> $output_file

cat >> $output_file << EOF
</body>
</html>
EOF


syntax highlighted by Code2HTML, v. 0.9.1