#! /bin/bash if [ "$1" == "" ]; then cat > /dev/stderr < Generates an html listing titled TITLE (to Std Output) of the current directory, using BASEDIR as the root directory for naming. EOF exit 1 fi BASE=$1 TITLE=$2 CURR=`pwd | egrep -o "$BASE.*$"` DIRS=`ls --color=never -dl * | grep "^d" | awk '{ print $8 }'` JFILES=`ls --color=never -dl * | grep "^-" | egrep "\.java$" | awk '{ print $8 }'` OFILES=`ls --color=never -dl * | grep "^-" | egrep -v "(*\.java$)|(\.class$)|(index\.html$)|(\.java\.html$)|(~$)" | awk '{ print $8 }'` cat <<EOF <html> <head> <title>$TITLE Listing: $CURR/

$TITLE Listing

$CURR/

EOF echo " " echo " " if [ "$CURR" != "$BASE" ]; then echo " " fi for i in $DIRS; do echo " " done echo " " if [ "$JFILES" != "" ]; then echo " " echo " " for i in $JFILES; do if [ ! -f "$i.html" ]; then HTMLize $i &> /dev/null fi echo " " done echo "  " fi if [ "$OFILES" != "" ]; then echo " " echo " " for i in $OFILES; do echo $i | egrep "(\.class$)|(index\.html$)|(~$)" &> /dev/null if [ $? == 1 ]; then echo $i | grep ".html$" &> /dev/null if [ $? == 1 ]; then echo " " else echo " " fi fi done fi cat < EOF
Directories

../
$i/
Java Files

$iPlainHTML
Other Files

$iPlain
$iHTML