From d095d6afd6c843f8fbf45d049d326738e9b0fe9f Mon Sep 17 00:00:00 2001 From: orionlee Date: Sat, 20 Aug 2016 15:56:49 -0700 Subject: [PATCH 1/2] Fix bash login when ${CMDER_ROOT} has spaces. E.g., if ${CMDER_ROOT} is /c/Users/Foo Bar/cmder, the following errors will occur: bash: pushd: /c/Users/Foo: No such file or directory bash: [: /c/Users/Foo: binary operator expected bash: /c/Users/Foo: No such file or directory --- vendor/cmder.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/cmder.sh b/vendor/cmder.sh index 4fac0be..c83ce1e 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -43,7 +43,7 @@ fi if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then unset profile_d_scripts - pushd ${CMDER_ROOT}/config/profile.d >/dev/null + pushd "${CMDER_ROOT}/config/profile.d" >/dev/null profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh 2>/dev/null) if [ ! "x${profile_d_scripts}" = "x" ] ; then @@ -55,8 +55,8 @@ if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then popd >/dev/null fi -if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then - . ${CMDER_ROOT}/config/user-profile.sh +if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then + . "${CMDER_ROOT}/config/user-profile.sh" else echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh" cat <<-eof >"${CMDER_ROOT}/config/user-profile.sh" From 5354b5f80f7e5d5db6259b71ff2967defe3c7107 Mon Sep 17 00:00:00 2001 From: orionlee Date: Sat, 20 Aug 2016 16:01:46 -0700 Subject: [PATCH 2/2] Further fix bash login when ${CMDER_ROOT} has spaces. Inspecting the script uncovers similar problems elsewhere not encountered in my initial testing. They are fixed accordingly. --- vendor/cmder.sh | 8 ++++---- vendor/cmder_exinit | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/vendor/cmder.sh b/vendor/cmder.sh index c83ce1e..5083d21 100644 --- a/vendor/cmder.sh +++ b/vendor/cmder.sh @@ -38,18 +38,18 @@ export PATH # Drop *.sh or *.zsh files into "${CMDER_ROOT}\config\profile.d" # to source them at startup. if [ ! -d "${CMDER_ROOT}/config/profile.d" ] ; then - mkdir -p ${CMDER_ROOT}/config/profile.d + mkdir -p "${CMDER_ROOT}/config/profile.d" fi if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then unset profile_d_scripts pushd "${CMDER_ROOT}/config/profile.d" >/dev/null - profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh 2>/dev/null) + profile_d_scripts=$(ls *.sh 2>/dev/null) if [ ! "x${profile_d_scripts}" = "x" ] ; then for x in ${profile_d_scripts} ; do - # echo Sourcing "${x}"... - . $x + # echo Sourcing "${CMDER_ROOT}/config/profile.d/${x}"... + . "${CMDER_ROOT}/config/profile.d/${x}" done fi popd >/dev/null diff --git a/vendor/cmder_exinit b/vendor/cmder_exinit index 7e83d64..99b5ac4 100644 --- a/vendor/cmder_exinit +++ b/vendor/cmder_exinit @@ -51,29 +51,29 @@ if [ ! "$CMDER_ROOT" = "" ] ; then # Drop *.sh or *.zsh files into "${CMDER_ROOT}\config\profile.d" # to source them at startup. if [ ! -d "${CMDER_ROOT}/config/profile.d" ] ; then - mkdir -p ${CMDER_ROOT}/config/profile.d + mkdir -p "${CMDER_ROOT}/config/profile.d" fi if [ -d "${CMDER_ROOT}/config/profile.d" ] ; then unset profile_d_scripts - pushd ${CMDER_ROOT}/config/profile.d >/dev/null + pushd "${CMDER_ROOT}/config/profile.d" >/dev/null if [ ! "x${ZSH_VERSION}" = "x" ]; then - profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.zsh 2>/dev/null) + profile_d_scripts=$(ls *.zsh 2>/dev/null) elif [ ! "x${BASH_VERSION}" = "x" ]; then - profile_d_scripts=$(ls ${CMDER_ROOT}/config/profile.d/*.sh 2>/dev/null) + profile_d_scripts=$(ls *.sh 2>/dev/null) fi if [ ! "x${profile_d_scripts}" = "x" ] ; then for x in ${profile_d_scripts} ; do - # echo Sourcing "${x}"... - . $x + # echo Sourcing "${CMDER_ROOT}/config/profile.d/${x}"... + . "${CMDER_ROOT}/config/profile.d/${x}" done fi popd >/dev/null fi - if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then - . ${CMDER_ROOT}/config/user-profile.sh + if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then + . "${CMDER_ROOT}/config/user-profile.sh" else echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh" cat <<-eof >"${CMDER_ROOT}/config/user-profile.sh"