summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2013-06-07 16:36:11 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2013-06-07 16:36:11 +0200
commit8f293bebc40c367793eac9c6af49c41c083c5533 (patch)
treed13dcdc44f8499ee0a0e40bf81fdc27dbf54ff2e
parent0ba9de9f37e50c73643d119c95cbe8a16bd5f82b (diff)
Create destination directory during a mkrc
Allow for creating new tags when making a new rc file using `mkrc`. If you pass `-t foo` and `tag-foo` doesn't exist, it first makes it exist.
-rwxr-xr-xbin/mkrc11
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/mkrc b/bin/mkrc
index e27570f..6cd2a2b 100755
--- a/bin/mkrc
+++ b/bin/mkrc
@@ -9,10 +9,10 @@ ROOT_DIR=$HOME
destination() {
- if [ $# -eq 1 ]; then
- echo $DOTFILES/$1
+ if [ $# -eq 0 ]; then
+ echo $DOTFILES
else
- echo $DOTFILES/tag-$2/$1
+ echo $DOTFILES/tag-$2
fi
}
@@ -55,7 +55,8 @@ files=$@
for file in $files; do
dotless=`echo $file | sed -e "s|$ROOT_DIR/||" | sed -e 's/^\.//'`
- mkdir
- $MV $file `destination $dotless $tag`
+ dest=`destination $dotless $tag`
+ mkdir -p $dest
+ $MV $file $dest/$dotless
install_dotfile $dotless $tag
done