#!/bin/ksh #Rename all the files in the current directory. Do not change the #contents of the files. Compare Handout 5, pp. 20-21. status=0 #innocent until proven guilty for filename in * do newname=`echo $filename | tr '[A-Z]' '[a-z]' | sed ' s/[ ]/-/g s/^-\(.\)/\1/ s/\.htm$/.html/ '` if [[ -f $newname ]] then echo $0: found $filename and $newname 1>&2 status=1 else echo $filename mv $filename $newname fi done exit $status