File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 1- #! /bin/sh
1+ #! /usr/ bin/env bash
22
33# This install script is intended to download and install the latest available
44# release of the Ecsact SDK.
@@ -103,21 +103,28 @@ install_ecsact_sdk_deb_package() {
103103}
104104
105105confirm_or_exit () {
106+ if ! [ -t 0 ]; then
107+ printf " $1 [y/N] ${green} Yes ${dim} (non-interactive)${reset} \n"
108+ return 0
109+ fi
110+
106111 if [ -n " $BASH_VERSION " ]; then
107112 read -p " $1 [y/N] " -n 1 -r
108- echo
109113 if [[ ! $REPLY =~ ^[Yy]$ ]]; then
110- printf " installation aborted \n"
114+ printf " ${red} \bNo ${reset} \n"
111115 return 1
112116 fi
117+
118+ printf " ${green} \bYes${reset} \n"
119+
113120 return 0
114121 fi
115122
116123 read -p " $1 [y/N] " yn
117124 case $yn in
118- [Yy]* ) break ;;
119- [Nn]* ) printf " ${red} Installation aborted ${reset} \n" ; return 1 ;;
120- * ) printf " ${red} Installation aborted${reset} \n" ; return 1 ;;
125+ [Yy]* ) printf " ${green} Yes ${reset} \n " break ; ;;
126+ [Nn]* ) printf " ${red} No ${reset} \n" ; return 1 ;;
127+ * ) printf " \n ${red} Installation aborted${reset} \n" ; return 1 ;;
121128 esac
122129
123130 return 0
@@ -153,5 +160,4 @@ ${reset}
153160
154161init_env_vars
155162install_ecsact_sdk
156- unset -f init_env_vars install_ecsact_sdk download_json download_file install_ecsact_sdk_deb_package confirm_or_exit
157163
You can’t perform that action at this time.
0 commit comments