aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-09-27 16:13:18 -0700
committerH. Peter Anvin <hpa@zytor.com>2011-09-27 16:13:18 -0700
commit51bf3b73d42500af4d637ab022e65e86323e2173 (patch)
tree2947f811606a4d8280d4b38d6080353ec120de77
parent08482dd0468ff6a5d75439eef128470387e729ea (diff)
downloadkup-51bf3b73d42500af4d637ab022e65e86323e2173.tar.gz
Allow the move destination to be a directory name ending in /
-rwxr-xr-xkup8
1 files changed, 8 insertions, 0 deletions
diff --git a/kup b/kup
index e754ace..0e878de 100755
--- a/kup
+++ b/kup
@@ -317,6 +317,14 @@ sub cmd_move()
if (!is_valid_filename($from)) {
die "$0: invalid pathname: $from\n";
}
+
+ if ($to =~ /\/$/) {
+ # Syntactic sugar: allow specifying a directory only by ending in /
+ if ($from =~ m:^(.*/|)([^/]+)$:) {
+ $to .= $2;
+ }
+ }
+
if (!is_valid_filename($to)) {
die "$0: invalid pathname: $to\n";
}