X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fmv-p;h=7259d33e6e0d5c47e96e5a15a393c8132536452f;hb=9df13622741df2a99bd4067157486098638610b8;hp=2faade8bc3e70754903c32c9f35686dd74f8286a;hpb=614f9080ac810a2f4c0a5244bca856f3358e625e;p=config%2Fdotfiles.git diff --git a/bin/mv-p b/bin/mv-p index 2faade8..7259d33 100755 --- a/bin/mv-p +++ b/bin/mv-p @@ -3,7 +3,7 @@ # Wrapper command for `mv` which creates the target directory before moving # the file there. -# Copyright (C) 2011-2012 Simon Ruderich +# Copyright (C) 2011-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,8 +19,12 @@ # along with this program. If not, see . +set -eu + # Get last argument. -for last; do :; done +for last; do + : +done mkdir -p "`dirname "$last"`" \ && mv "$@"