Os operadores bash
para alterar o caso das variáveis são ${var^^*}
para cima e ${var,,*}
para menor, então:
#! /bin/bash -
die() { printf >&2 '%s\n' "$@"; exit 1; }
usage() { die "Usage:" " $0 "{"lower upp","upper low"}"er [files]"; }
(( $# >= 2 )) || usage
from=$1 to=$2; shift 2
[[ $from = @(upper|lower) ]] &&
[[ $to = @(upper|lower) ]] &&
[[ "$from" != "$to" ]] || usage
shopt -s nullglob dotglob
IFS= ret=0
(( $# > 0 )) || set -- *[[:$from:]]*
for file do
case $to in
(upper) newfile=${file^^*};;
(lower) newfile=${file,,*};;
esac
[[ "$file" = "$newfile" ]] ||
echo mv -i -- "$file" "$newfile" ||
ret=$?
done
exit "$ret"
Remova o echo
quando terminar de testar.