Skip to content

Instantly share code, notes, and snippets.

@robrwo
Last active January 2, 2016 12:19
Show Gist options
  • Save robrwo/8302339 to your computer and use it in GitHub Desktop.
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
#!/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