]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
bin/mv-p: Add.
authorSimon Ruderich <simon@ruderich.org>
Sat, 22 Oct 2011 16:33:08 +0000 (18:33 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sat, 22 Oct 2011 16:33:08 +0000 (18:33 +0200)
bin/mv-p [new file with mode: 0755]

diff --git a/bin/mv-p b/bin/mv-p
new file mode 100755 (executable)
index 0000000..62b1b36
--- /dev/null
+++ b/bin/mv-p
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Wrapper command for `mv` which creates the target directory before moving
+# the file there.
+
+
+# Get last argument.
+for last; do :; done
+
+mkdir -p "`dirname "$last"`" \
+    && mv "$@"