Skip to content

Instantly share code, notes, and snippets.

@kcollasarundell
Created March 19, 2013 04:48
Show Gist options
  • Save kcollasarundell/5193778 to your computer and use it in GitHub Desktop.
Save kcollasarundell/5193778 to your computer and use it in GitHub Desktop.
Shitty LocalCommand wrapper
#!/bin/bash
SYNCFILES=( ~/bin ~/.vim ~/.vimrc ~/.bashrc ~/.profile )
VER=4
DIR="$HOME/.tmp"
if [ ! -d $DIR ]
then
mkdir $DIR
fi
if [ -a $DIR/$1 ]
then
FILEVER=`cat $DIR/$1`
if [ $FILEVER != $VER ]
then
(sleep 1 ; /usr/bin/rsync -Lar -e 'ssh -o permitlocalcommand=no ' ${SYNCFILES[@]} $1: && echo $VER > $DIR/$1) &
fi
else
(sleep 1; /usr/bin/rsync -Lar -e 'ssh -o permitlocalcommand=no ' ${SYNCFILES[@]} $1: && echo $VER > $DIR/$1) &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment