From: Moviuro Date: Sun, 4 Jan 2015 21:39:06 +0000 (+0100) Subject: zshrc: bk() now works on directories with trailing / X-Git-Tag: v0.11.0~8 X-Git-Url: http://git.grml.org/?a=commitdiff_plain;ds=sidebyside;h=8075930b39b2748a5b0495985fb15fa32b5718f9;p=grml-etc-core.git zshrc: bk() now works on directories with trailing / --- 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