From db5494c80901342310c623979544d45e1864e67e Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Wed, 4 Jan 2017 18:07:48 +0100 Subject: [PATCH] install: use readlink to resolve symlinks The `file(1)` shipped on macOS doesn't resolve symlinks: $ echo foo > file $ ln -s file link $ /usr/bin/file link link: ASCII text Unfortunately the `readlink(1)` on macOS doesn't support the `-f` flag as well, so we just match against the end of the string. --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index a9cd64cb3..281d30c68 100755 --- a/install.sh +++ b/install.sh @@ -35,7 +35,7 @@ install_vim () { fi if [[ -d "$HOME/.vim" ]]; then - if file "$HOME/.vim" | grep "$HOME/.SpaceVim" &>/dev/null; then + if [[ "$(readlink $HOME/.vim)" =~ \.SpaceVim$ ]]; then echo -e "${Blue}Installed SpaceVim for vim${Color_off}" else mv "$HOME/.vim" "$HOME/.vim_back" @@ -52,7 +52,7 @@ install_vim () { install_neovim () { if [[ -d "$HOME/.config/nvim" ]]; then - if file "$HOME/.config/nvim" | grep "$HOME/.SpaceVim" &>/dev/null; then + if [[ "$(readlink $HOME/.config/nvim)" =~ \.SpaceVim$ ]]; then echo -e "${Blue}Installed SpaceVim for neovim${Color_off}" else mv "$HOME/.config/nvim" "$HOME/.config/nvim_back"