Lowercase or uppercase file in fedora

This is the simple code using bash to change uppercase to lowercase easily in
Fedora, simply add this function to .bashrc

lower() {
  for file ; do
    filename=${file##*/}
    case "$filename" in
    */* ) dirname==${file%/*} ;;
      * ) dirname=.;;
    esac
    nf=$(echo $filename | tr A-Z a-z)
    newname="${dirname}/${nf}"
    if [[ "$nf" != "$filename" ]]; then
      mv "$file" "$newname"
      echo "lowercase: $file --> $newname"
    else
      echo "lowercase: $file not changed."
    fi
  done
}

done, now try run command lower $yourfilename in console.

for vice-versa (lower to uppercase) just change the value A-Z a-z to a-z A-Z

upper() {
  for file ; do
    filename=${file##*/}
    case "$filename" in
    */* ) dirname==${file%/*} ;;
      * ) dirname=.;;
    esac
    nf=$(echo $filename | tr a-z A-Z)
    newname="${dirname}/${nf}"
    if [[ "$nf" != "$filename" ]]; then
      mv "$file" "$newname"
      echo "uppercase: $file --> $newname"
    else
      echo "uppercase: $file not changed."
    fi
  done
}

now we can use upper $filename command to change the file from lowercase to uppercase