From 1f33e0ad556250ce876301045772bc0355a47e9b Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 30 Nov 2023 15:05:16 -0500 Subject: [PATCH] FIX: Y/n prompt should treat "no value" as yes --- discourse-doctor | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/discourse-doctor b/discourse-doctor index 0c7ea18..cf7d01c 100755 --- a/discourse-doctor +++ b/discourse-doctor @@ -314,18 +314,19 @@ print_done() { log "==================== DONE! ====================" DOCTOR_FILE=$(date +%s | sha256sum | base64 | head -c 20).txt - if [ $app_name == 'app' ] && [ "$NO_CONTAINER" != 'y' ] - then - read -p "Would you like to serve a publicly available version of this file? (Y/n)" serve - if [ $serve == 'Y' ] - then + if [ $app_name == 'app' ] && [ "$NO_CONTAINER" != 'y' ]; then + read -p "Would you like to serve a publicly available version of this file? (Y/n) " serve + case "${serve:-Y}" in + y*|Y*) cp $LOG_FILE shared/standalone/log/var-log/$DOCTOR_FILE sudo docker exec -w /var/www/discourse -i $app_name cp /var/log/$DOCTOR_FILE public log "The output of this program may be available at http://$DISCOURSE_HOSTNAME/$DOCTOR_FILE" log "You should inspect that file carefully before sharing the URL." - else + ;; + *) log "Publicly available log not generated." - fi + ;; + esac fi # The following is not in the web log file since it was copied above, which seems correct log -- 2.25.1