From 3a6815f70e9088bcc87c99830735c360d3fecc4e Mon Sep 17 00:00:00 2001 From: Greg Cobb Date: Fri, 26 Aug 2022 10:01:52 -0700 Subject: [PATCH] Update bosh lite pool scripts to work on ZSH - Issues: - https://unix.stackexchange.com/questions/255480/why-does-behave-differently-inside-in-zsh-and-bash - https://superuser.com/questions/555874/zsh-read-command-fails-within-bash-function-read1-p-no-coprocess --- lib/claim-bosh-lite.bash | 4 ++-- lib/unclaim-bosh-lite.bash | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/claim-bosh-lite.bash b/lib/claim-bosh-lite.bash index 3044b17..ac0be7f 100755 --- a/lib/claim-bosh-lite.bash +++ b/lib/claim-bosh-lite.bash @@ -97,7 +97,7 @@ function claim_bosh_lite() { file=`find . -name $env` - if [ "$file" == "" ]; then + if [[ "$file" == "" ]]; then echo $env does not exist return 1 fi @@ -212,7 +212,7 @@ EOF echo "$PWD/$(basename "${env_file}")" ) - if [ "$?" == 0 ]; then + if [[ "$?" == 0 ]]; then direnv allow "${env_dir}" echo "Changing directory to '${env_dir}'..." cd "${env_dir}" diff --git a/lib/unclaim-bosh-lite.bash b/lib/unclaim-bosh-lite.bash index d859db8..ae4ba20 100755 --- a/lib/unclaim-bosh-lite.bash +++ b/lib/unclaim-bosh-lite.bash @@ -32,12 +32,13 @@ function unclaim_bosh_lite() { env=$1 file="$(find "${working_pool}" -name "${env}")" - if [ "$file" == "" ]; then + if [[ "$file" == "" ]]; then echo "$env does not exist in ${working_pool}" return 1 fi - read -r -p "Hit enter to release ${env} " + printf "Hit enter to release ${env} " + read -r git mv "${file}" "${broken_pool}/unclaimed/" if [ -d "${env}" ]; then