Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yes no parsing #664

Merged
merged 10 commits into from
May 12, 2023
39 changes: 20 additions & 19 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ then
printf " Are sure you want to continue the installation? [yes|no]\\n"
printf "[no] >>> "
read -r ans
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "y" ] && [ "$ans" != "Y" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
if [ "$ans" != "YES" ] && [ "$ans" != "Y" ]
then
printf "Aborting installation\\n"
exit 2
Expand All @@ -154,8 +154,8 @@ then
printf " Are sure you want to continue the installation? [yes|no]\\n"
printf "[no] >>> "
read -r ans
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "y" ] && [ "$ans" != "Y" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
if [ "$ans" != "YES" ] && [ "$ans" != "Y" ]
then
printf "Aborting installation\\n"
exit 2
Expand All @@ -171,8 +171,8 @@ then
printf " Are sure you want to continue the installation? [yes|no]\\n"
printf "[no] >>> "
read -r ans
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "y" ] && [ "$ans" != "Y" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
if [ "$ans" != "YES" ] && [ "$ans" != "Y" ]
then
printf "Aborting installation\\n"
exit 2
Expand All @@ -188,8 +188,8 @@ then
printf " Are sure you want to continue the installation? [yes|no]\\n"
printf "[no] >>> "
read -r ans
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "y" ] && [ "$ans" != "Y" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
if [ "$ans" != "YES" ] && [ "$ans" != "Y" ]
then
printf "Aborting installation\\n"
exit 2
Expand All @@ -205,8 +205,8 @@ then
printf " Are sure you want to continue the installation? [yes|no]\\n"
printf "[no] >>> "
read -r ans
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "y" ] && [ "$ans" != "Y" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
if [ "$ans" != "YES" ] && [ "$ans" != "Y" ]
then
printf "Aborting installation\\n"
exit 2
Expand All @@ -222,8 +222,8 @@ then
printf " Are sure you want to continue the installation? [yes|no]\\n"
printf "[no] >>> "
read -r ans
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "y" ] && [ "$ans" != "Y" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
if [ "$ans" != "YES" ] && [ "$ans" != "Y" ]
then
printf "Aborting installation\\n"
exit 2
Expand All @@ -239,8 +239,8 @@ then
printf " Are sure you want to continue the installation? [yes|no]\\n"
printf "[no] >>> "
read -r ans
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "y" ] && [ "$ans" != "Y" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
if [ "$ans" != "YES" ] && [ "$ans" != "Y" ]
then
printf "Aborting installation\\n"
exit 2
Expand Down Expand Up @@ -268,14 +268,15 @@ EOF
printf "Do you accept the license terms? [yes|no]\\n"
printf "[no] >>> "
read -r ans
while [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "no" ] && [ "$ans" != "No" ] && [ "$ans" != "NO" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
while [ "$ans" != "YES" ] && [ "$ans" != "NO" ] && [ "$ans" != "" ]
do
printf "Please answer 'yes' or 'no':'\\n"
printf ">>> "
read -r ans
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
done
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ]
if [ "$ans" != "YES" ]
then
printf "The license agreement wasn't approved, aborting installation.\\n"
exit 2
Expand Down Expand Up @@ -548,8 +549,8 @@ if [ "$BATCH" = "0" ]; then
if [ "$ans" = "" ]; then
ans=$DEFAULT
fi
if [ "$ans" != "yes" ] && [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && \
[ "$ans" != "y" ] && [ "$ans" != "Y" ]
ans=$(echo "${ans}" | tr '[:lower:]' '[:upper:]')
if [ "$ans" != "YES" ] && [ "$ans" != "Y" ]
then
printf "\\n"
printf "You have chosen to not have conda modify your shell scripts at all.\\n"
Expand Down
19 changes: 19 additions & 0 deletions news/664-fix-yes-no-parsing
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Improve parsing of yes/no prompts
jaimergp marked this conversation as resolved.
Show resolved Hide resolved

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>