From 4f0b1fa7eceb7b2a61c45e655882b4e987462361 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 14 May 2020 19:21:11 -0400 Subject: [PATCH] bin: Improve the run-as-root confirmation prompt * Send the prompt to stderr * Print "> " without a newline so the user knows it is a prompt * Wrap long lines * Use a here-document --- bin/run.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/run.sh b/bin/run.sh index 23bc3b905..c7d2d35e5 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -18,8 +18,12 @@ done # Stop the script if it's started as root if [ "$(id -u)" -eq 0 ] && [ "$ignoreRoot" -eq 0 ]; then - echo "You shouldn't start Etherpad as root!" - echo "Please type 'Etherpad rocks my socks' or supply the '--root' argument if you still want to start it as root" + cat <&2 +You shouldn't start Etherpad as root! +Please type 'Etherpad rocks my socks' (or restart with the '--root' +argument) if you still want to start it as root: +EOF + printf "> " >&2 read rocks [ "$rocks" = "Etherpad rocks my socks" ] || fatal "Your input was incorrect" fi