Created
January 5, 2012 15:14
-
-
Save miccolis/1565664 to your computer and use it in GitHub Desktop.
link dotfiles into a home dir
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/sh | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
FILES=`ls -a $DIR`; | |
for FILENAME in $FILES; do | |
if [ ${FILENAME:0:1} == "." -a ${#FILENAME} -gt "2" ]; then | |
EXT=${FILENAME##*.} | |
# Ignore vi swp files. | |
if [ $EXT == "swp" ]; then | |
continue; | |
fi | |
FILEPATH="$DIR/$FILENAME"; | |
if [ -e ~/$FILENAME ]; then | |
echo "> File '$FILENAME' exists, skipping."; | |
else | |
echo "> Linking '$FILENAME'"; | |
ln -s $FILEPATH ~/$FILENAME | |
fi | |
fi; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment