Last active
January 2, 2016 12:19
-
-
Save robrwo/8302339 to your computer and use it in GitHub Desktop.
This is a quick-and-dirty utility to synchronise dotfiles and utilities to other machines
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 | |
hostname=$1 | |
command=`basename $0` | |
if [ -z "${hostname}" ]; then | |
echo Usage: ${command} hostname | |
exit 1 | |
fi | |
if [ ${hostname} == `hostname -s` ]; then | |
echo Cannot sync to self | |
exit 1 | |
fi | |
for file in .bash_profile .bash_aliases .bash_prompt .bashrc \ | |
.forward \ | |
.emacs .emacs.d/ \ | |
.gitconfig \ | |
.inputrc \ | |
bin/ | |
do | |
if [ -e ${file} ]; then | |
rsync --archive --partial --compress --cvs-exclude \ | |
${file} ${hostname}:${file} | |
if [ $? -ne 0 ]; then | |
echo Error synchronising ${file} - aborting >&2 | |
exit 1 | |
fi | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment