From 8075930b39b2748a5b0495985fb15fa32b5718f9 Mon Sep 17 00:00:00 2001 From: Moviuro Date: Sun, 4 Jan 2015 22:39:06 +0100 Subject: [PATCH] zshrc: bk() now works on directories with trailing / --- etc/zsh/zshrc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 14923e7..d567257 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -3051,23 +3051,17 @@ EOT shift "$((OPTIND-1))" if (( keep > 0 )); then while (( $# > 0 )); do - if islinux; then - cp $verbose -a "$1" "$1_$current_date" - elif isfreebsd; then - if [[ -d "$1" ]] && [[ "$1" == */ ]]; then - echo "cowardly refusing to copy $1 's content; see cp(1)" >&2; return 1 - else - cp $verbose -a "$1" "$1_$current_date" - fi + if islinux || isfreebsd; then + cp $verbose -a "${1%/}" "${1%/}_$current_date" else; - cp $verbose -pR "$1" "$1_$current_date" + cp $verbose -pR "${1%/}" "${1%/}_$current_date" fi (( result += $? )) shift done elif (( move > 0 )); then while (( $# > 0 )); do - mv $verbose "$1" "$1_$current_date" + mv $verbose "${1%/}" "${1%/}_$current_date" (( result += $? )) shift done -- 2.1.4