From b8ea5c4a02cd628509e9a28919257df6a022a3dd Mon Sep 17 00:00:00 2001 From: spacewander Date: Wed, 7 Dec 2016 10:39:53 +0800 Subject: [PATCH] fix git-extras update and tweak Windows detection Replace expr with bash substring expansion. Tested under: GNU bash, version 4.3.42(5)-release (x86_64-pc-msys) GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16) --- bin/git-extras | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/git-extras b/bin/git-extras index 7104bbe..1b494fc 100755 --- a/bin/git-extras +++ b/bin/git-extras @@ -4,7 +4,7 @@ VERSION="4.3.0-dev" INSTALL_SCRIPT="https://raw.githubusercontent.com/tj/git-extras/master/install.sh" update() { - local bin=$(which git-extras) + local bin="$(which git-extras)" local prefix=${bin%/*/*} local orig=$PWD @@ -14,7 +14,7 @@ update() { } updateForWindows() { - local bin=$(which git-extras) + local bin="$(which git-extras)" local prefix=${bin%/*/*} local orig=$PWD @@ -39,9 +39,9 @@ case "$1" in ;; update) platform=$(uname -s) - if [ $(expr substr "$platform" 1 9) = "CYGWIN_NT" ] || \ - [ $(expr substr "$platform" 1 10) = "MINGW32_NT" ] || \ - [ $(expr substr "$platform" 1 10) = "MINGW64_NT" ] + if [ "${platform::9}" = "CYGWIN_NT" ] || \ + [ "${platform::5}" = "MINGW" ] || \ + [ "${platform::7}" = "MSYS_NT" ] then updateForWindows else