projects
/
grml-etc-core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cd79c20
)
zshrc: bk() now works on directories with trailing /
author
Moviuro
<moviuro+grml@gmail.com>
Sun, 4 Jan 2015 21:39:06 +0000
(22:39 +0100)
committer
Moviuro
<moviuro+grml@gmail.com>
Sun, 4 Jan 2015 21:39:06 +0000
(22:39 +0100)
etc/zsh/zshrc
patch
|
blob
|
history
diff --git
a/etc/zsh/zshrc
b/etc/zsh/zshrc
index
14923e7
..
d567257
100644
(file)
--- a/
etc/zsh/zshrc
+++ b/
etc/zsh/zshrc
@@
-3051,23
+3051,17
@@
EOT
shift "$((OPTIND-1))"
if (( keep > 0 )); then
while (( $# > 0 )); do
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;
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
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
(( result += $? ))
shift
done