Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (15 sloc) 312 Bytes
function backup {
local FILE=$1
if [ -L $FILE ]; then
rm $FILE
elif [ -e $FILE ]; then
mv $FILE $FILE.bak
fi
}
function link_with_backup {
local FILENAME=$1
local SOURCE=$DOTFILES/$FILENAME
local TARGET=$HOME/$FILENAME
backup $TARGET
ln -sf $SOURCE $TARGET
}