#!/bin/bash getDestFile() { if [ -n "${destinationrename[$destination]}" ] \ && ( ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{album\}?([^\]])* ]] \ && [ -n "$album" ] ) || ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{albumartist\}?([^\]])* ]] \ && [ -n "$albumartist" ] ) || ( [[ ${destinationrenamepath[$destination]} == \ *?([^[])%\{releasecountry\}?([^\]])* ]] \ && [ -n "$releasecountry" ] ) || ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{artist\}?([^\]])* ]] \ && [ -n "$artist" ] ) || ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{genre\}?([^\]])* ]] \ && [ -n "$genre" ] ) || ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{title\}?([^\]])* ]] \ && [ -n "$title" ] ) || ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{track\}?([^\]])* ]] \ && [ -n "$track" ] ) || ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{year\}?([^\]])* ]] \ && [ -n "$year" ] ) || ( [[ ${destinationrename[$destination]} == \ *?([^[])%\{disc\}?([^\]])* ]] \ && [ -n "$disc" ] ) ) then destfile="${destinationrename[$destination]//?(\[)%\{album\}?(\])/$album}" destfile="${destfile//?(\[)%\{albumartist\}?(\])/$albumartist}" destfile="${destfile//?(\[)%\{releasecountry\}?(\])/$releasecountry}" destfile="${destfile//?(\[)%\{artist\}?(\])/$artist}" destfile="${destfile//?(\[)%\{genre\}?(\])/$genre}" destfile="${destfile//?(\[)%\{title\}?(\])/$title}" tracknumber="${track%/*}" destfile="${destfile//?(\[)%\{track\}?(\])/$tracknumber}" destfile="${destfile//?(\[)%\{year\}?(\])/$year}" destfile="${destfile//?(\[)%\{disc\}?(\])/$disc}" else destfile="${filename##*/}" destfile="${destfile%.*}" fi if (( ${destinationascii["$destination"]} )) then echo "$destfile" >&${toascii[1]} read -r -u${toascii[0]} destfile fi destfile=$(sanitizeFile "$destfile") }