#!/bin/sh # written by guido socher help() { echo "run lfparser on all files in one or more directories" echo "USAGE: runlfparser [-h] [-l lang] a_directory [a_second_directory]" exit 0 } not_a_dir() { echo "ERROR: $1 is not a directory" exit 1 } while [ -n "$1" ]; do case $1 in -h) help;shift 1;; -l) opt_l="-l $2";shift 2;; -*) echo "error: no such option $1. -h for help";exit 1;; *) break;; esac done [ -z "$1" ] && help for i in $*; do [ -d "$i" ] || not_a_dir $i mlist=`find $i -print | egrep "meta\..?html$"` for f in $mlist ; do ff=`echo $f | sed -e 's/\.meta//'` echo "running lfparser $opt_l $f > $ff" lfparser $opt_l $f > $ff done done #__END__