Search form

Bash: Make a Web Site Index

An old Bash script that uses awk to construct an index with hyperlinks from the .html files in a web tree. Attempts to use the <title> tag to name them.

#!/bin/bash

for dir in html img inc home; do
    echo
    echo "
" newstring=$dir firstchar=${newstring:0:1} string1=${newstring:1} dirname=`echo $firstchar | tr '[a-z]' '[A-Z]'` echo "" echo "

$dirname$string1

" echo "
    " for file in `find $dir -name \*.html -print`; do #echo $file title=`awk 'BEGIN{IGNORECASE=1;FS="|";RS=EOF} {print $2}' $file` if [ -z "$title" ]; then title="NO TITLE! - $file" fi echo "
  • $title
  • " done echo "
" echo "
" done

Categories: