Skip to content

Instantly share code, notes, and snippets.

@informationsea
Created April 17, 2013 09:56
Show Gist options
  • Save informationsea/5403136 to your computer and use it in GitHub Desktop.
Save informationsea/5403136 to your computer and use it in GitHub Desktop.
Install dot files from repository. This script create symbolic links from all files starts with "dot_" in current directory to a home directory.
#!/bin/bash
DOTFILES=`find "$PWD" -mindepth 1 -maxdepth 1 -name "dot_*"`
TIME=`LANG=C date`
pushd "$HOME"
for i in $DOTFILES;do
NEWNAME=`basename "$i" | sed -e "s|^dot_|$HOME/.|"`
if [ -L "$NEWNAME" ];then
echo "$NEWNAME is already symbolic link"
else
echo "$i" "-->" "$NEWNAME"
if [ -e "$NEWNAME" ];then
mv "$NEWNAME" "${NEWNAME}-${TIME}"
fi
ln -s "$i" "$NEWNAME"
fi
done
mkdir -p ~/Documents/Editor/Backups
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment