Last active
December 11, 2015 22:58
-
-
Save igrep/4672845 to your computer and use it in GitHub Desktop.
maybe useful when you want to try your committed vimscript on your vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# maybe useful when you want to try your committed vimscript on your vim | |
# WARNING: as written, this script doesn't backup the destination directory | |
GIT_PAGER=cat | |
PAGER=cat | |
updated_files=$(git diff --name-only master) | |
dest_dir=$1 | |
if [ ! $dest_dir ] ; then | |
echo specify path to install! | |
exit 1 | |
fi | |
IFS=$'\n' | |
for src in $updated_files ; do | |
dest=$dest_dir/$src | |
if [ -e $src ] ; then | |
dest_parent=$(dirname $dest) | |
if [ ! -e $dest_parent ] ; then | |
echo mkdir -p $dest_parent | |
mkdir -p $dest_parent | |
fi | |
echo cp $src $dest | |
cp $src $dest | |
else | |
echo rm $dest | |
rm $dest | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment