From c81f1879fcf4ee72b9e2f638de1f4634c720902c Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Wed, 19 Jun 2013 12:54:05 +0200 Subject: [PATCH] setup/destination: tiny fixes --- lib/setup/destination | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/setup/destination b/lib/setup/destination index bd3c152..9c4925a 100644 --- a/lib/setup/destination +++ b/lib/setup/destination @@ -222,18 +222,19 @@ setupDestination() { Leave blank if you don't want file renaming. EODesc initialvalue="${destinationrenamepath["$destination"]}" - initialvalue+="${initialvalue+/}" + initialvalue+=/ + [[ $initialvalue == / ]] && unset initialvalue initialvalue+="${destinationrename["$destination"]}" + [ -z "$initialvalue" ] && unset initialvalue read \ -e \ ${initialvalue+-i"$initialvalue"} \ -p'Rename pattern: ' \ value - case "$value" in - */*) - destinationrenamepath["$destination"]="${value%/*}" - ;; - esac + if [[ $value =~ / ]] + then + destinationrenamepath["$destination"]="${value%/*}" + fi destinationrename["$destination"]="${value##*/}" cat <<-EODesc @@ -272,12 +273,13 @@ setupDestination() { This prompt will loop until an empty string is encountered. EODesc - destinationskipmime["$destination"]="${destinationskipmime["$destination"]}|" - while [[ ${destinationskipmime["$destination"]} =~ / ]] + while [[ ${destinationskipmime["$destination"]} =~ \| ]] do skippedmimes+=("${destinationskipmime["$destination"]%%|*}") destinationskipmime["$destination"]="${destinationskipmime["$destination"]#*|}" done + [ -n "${destinationskipmime["$destination"]}" ] \ + && skippedmimes+=("${destinationskipmime["$destination"]}") count=${#skippedmimes[@]} unset destinationskipmime["$destination"] for (( i=0 ; 1 ; i++ )) @@ -307,12 +309,13 @@ setupDestination() { This prompt will loop until an empty string is encountered. EODesc - destinationcopymime["$destination"]="${destinationcopymime["$destination"]}|" - while [[ ${destinationcopymime["$destination"]} =~ / ]] + while [[ ${destinationcopymime["$destination"]} =~ \| ]] do copiedmimes+=("${destinationcopymime["$destination"]%%|*}") destinationcopymime["$destination"]="${destinationcopymime["$destination"]#*|}" done + [ -n "${destinationcopymime["$destination"]}" ] \ + && copiedmimes+=("${destinationcopymime["$destination"]}") count=${#copiedmimes[@]} unset destinationcopymime["$destination"] for (( i=0 ; 1 ; i++ ))