Generate index.html for a given directory
!/bin/bash
Author : Hemanth.HM
Email : [email protected]
Purpose : To genrate index.html for a give directory.
Usage : bash index.sh
dir=$1 cwd=$PWD
Check for input
[ -z ${dir} ] && echo "Usage : basename $0
In case the user gives the input as "."
[ "${dir}" == "." ] && dir=pwd
Collect each file and add them to href's
INDEX=$(for f in *; do printf '
Create an index.html file
cat > index.html << EOI