From 8a043d414ba0ed7def9669e8ffb2508576b48ddc Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Fri, 4 Mar 2011 19:16:49 -0800 Subject: [PATCH] DRY up init.sh and add .gitconfig --- init.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/init.sh b/init.sh index 87758db..bff898f 100755 --- a/init.sh +++ b/init.sh @@ -8,9 +8,13 @@ else CONFIG_PATH="${HOME}/config" fi -[ -e ".ackrc" ] || ln -s "${CONFIG_PATH}/ackrc" ".ackrc" -[ -e ".emacs" ] || ln -s "${CONFIG_PATH}/emacs" ".emacs" -[ -e ".emacs.d" ] || ln -s "${CONFIG_PATH}/emacs.d" ".emacs.d" -[ -e ".screenrc" ] || ln -s "${CONFIG_PATH}/screenrc" ".screenrc" -[ -e ".vimrc" ] || ln -s "${CONFIG_PATH}/vimrc" ".vimrc" -[ -e ".zshenv" ] || ln -s "${CONFIG_PATH}/zshenv" ".zshenv" +link_config() { + file="$1" + [ -e ".$file" ] || ln -s "${CONFIG_PATH}/$file" ".$file" +} + +CONFIG_FILES="ackrc emacs emacs.d gitconfig screenrc vimrc zshenv" + +for file in $CONFIG_FILES; do + link_config "$file" +done