From bfc3c1c4ab0f489f0c8a1e12752d4aef22a6141c Mon Sep 17 00:00:00 2001 From: Scott Mahr Date: Thu, 12 Apr 2018 17:16:46 -0700 Subject: [PATCH] cleaner dotfile exclusion when symlinking on setup --- setup.sh | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/setup.sh b/setup.sh index c486f03..0cfeebc 100755 --- a/setup.sh +++ b/setup.sh @@ -12,33 +12,17 @@ success() { printf "\r\033[00;32m[ !! ] ยป\033[0m $1\n" } -contains() { - local n=$# - local value=${!n} - for ((i=1;i < $#;i++)) { - if [ "${!i}" == "${value}" ]; then - echo true - return 0 - fi - } - echo false - return 1 -} - link() { rm -f "$2" ln -s "$1" "$2" } begin() { - exclusions=(".DS_Store" "README.md", "setup.sh", ".git", "LICENSE-MIT.txt") - # Symlink all the things user "Symlinking dotfiles." for file in .[^.]*; do - if [ $(contains "${exclusions[@]}" "$file") == false ]; then - link "`pwd`/$file" "$HOME/$file" - fi + [[ $file =~ (.git|.DS_Store)$ ]] && continue + link "`pwd`/$file" "$HOME/$file" done info "Dotfiles symlinked."