From: Simon Ruderich Date: Sat, 22 Oct 2011 16:33:08 +0000 (+0200) Subject: bin/mv-p: Add. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=476431ae68b86d0f4df57e5efdb0371b2b795be0;hp=8c1cafafeb7d79d512d16bd3fe258b2569f5406c;p=config%2Fdotfiles.git bin/mv-p: Add. --- diff --git a/bin/mv-p b/bin/mv-p new file mode 100755 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 "$@"