setup/destination: tiny fixes

This commit is contained in:
Vincent Riquer 2013-06-19 12:54:05 +02:00
parent 4822d95760
commit c81f1879fc

View File

@ -222,18 +222,19 @@ setupDestination() {
Leave blank if you don't want file renaming. Leave blank if you don't want file renaming.
EODesc EODesc
initialvalue="${destinationrenamepath["$destination"]}" initialvalue="${destinationrenamepath["$destination"]}"
initialvalue+="${initialvalue+/}" initialvalue+=/
[[ $initialvalue == / ]] && unset initialvalue
initialvalue+="${destinationrename["$destination"]}" initialvalue+="${destinationrename["$destination"]}"
[ -z "$initialvalue" ] && unset initialvalue
read \ read \
-e \ -e \
${initialvalue+-i"$initialvalue"} \ ${initialvalue+-i"$initialvalue"} \
-p'Rename pattern: ' \ -p'Rename pattern: ' \
value value
case "$value" in if [[ $value =~ / ]]
*/*) then
destinationrenamepath["$destination"]="${value%/*}" destinationrenamepath["$destination"]="${value%/*}"
;; fi
esac
destinationrename["$destination"]="${value##*/}" destinationrename["$destination"]="${value##*/}"
cat <<-EODesc cat <<-EODesc
@ -272,12 +273,13 @@ setupDestination() {
This prompt will loop until an empty string is encountered. This prompt will loop until an empty string is encountered.
EODesc EODesc
destinationskipmime["$destination"]="${destinationskipmime["$destination"]}|" while [[ ${destinationskipmime["$destination"]} =~ \| ]]
while [[ ${destinationskipmime["$destination"]} =~ / ]]
do do
skippedmimes+=("${destinationskipmime["$destination"]%%|*}") skippedmimes+=("${destinationskipmime["$destination"]%%|*}")
destinationskipmime["$destination"]="${destinationskipmime["$destination"]#*|}" destinationskipmime["$destination"]="${destinationskipmime["$destination"]#*|}"
done done
[ -n "${destinationskipmime["$destination"]}" ] \
&& skippedmimes+=("${destinationskipmime["$destination"]}")
count=${#skippedmimes[@]} count=${#skippedmimes[@]}
unset destinationskipmime["$destination"] unset destinationskipmime["$destination"]
for (( i=0 ; 1 ; i++ )) for (( i=0 ; 1 ; i++ ))
@ -307,12 +309,13 @@ setupDestination() {
This prompt will loop until an empty string is encountered. This prompt will loop until an empty string is encountered.
EODesc EODesc
destinationcopymime["$destination"]="${destinationcopymime["$destination"]}|" while [[ ${destinationcopymime["$destination"]} =~ \| ]]
while [[ ${destinationcopymime["$destination"]} =~ / ]]
do do
copiedmimes+=("${destinationcopymime["$destination"]%%|*}") copiedmimes+=("${destinationcopymime["$destination"]%%|*}")
destinationcopymime["$destination"]="${destinationcopymime["$destination"]#*|}" destinationcopymime["$destination"]="${destinationcopymime["$destination"]#*|}"
done done
[ -n "${destinationcopymime["$destination"]}" ] \
&& copiedmimes+=("${destinationcopymime["$destination"]}")
count=${#copiedmimes[@]} count=${#copiedmimes[@]}
unset destinationcopymime["$destination"] unset destinationcopymime["$destination"]
for (( i=0 ; 1 ; i++ )) for (( i=0 ; 1 ; i++ ))