#!/bin/bash for file in * ; do words=("$file") title="" wc=0 for word in $words ; do first=$(echo $word | cut -c1 | tr ‘[[:lower:]]’ ‘[[:upper:]]’) others=$(echo $word | cut -c2-) word="$first$others" for prep in {The,A,An,As,At,But,By,For,In,Of,Off,On,Per,To,Up,Via,And,Nor,Or,So,Yet,With} do if [[ $wc -gt 0 ]] ; then if [[ "$word" == "$prep" ]] ; then word=`echo "$word" | tr '[A-Z]' '[a-z]'` fi fi done title="$title$word" title="$title " wc=$(($wc + 1)) done #echo "$title" mv -- "$file" "$title" > /dev/null 2>&1 doneOne thing it DOES NOT do is capitalize last word if it is a preposition which seems to be the rule in all three title case schools (Chicago, MLA and AP), but this does the job in probably 95%~99% cases.