Use printf and case around the read statements to make the prompts a bit friendlier

pull/58/head
Miles Goodhew 2023-01-26 01:33:34 +11:00
parent c0281e1d05
commit 53e8b12bcb
3 changed files with 16 additions and 16 deletions

View File

@ -52,11 +52,11 @@ echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
${TEXT_EDITOR} /etc/modprobe.d/${OPTIONS_FILE}
echo "Do you want to apply the new options by rebooting now? [y/N] "
printf "Do you want to apply the new options by rebooting now? [y/N] "
read -r REPLY
echo # move to a new line
if [ "${REPLY}" = y ] || [ "${REPLY}" = Y ]; then
reboot
fi
case "$REPLY" in
[yY]*) reboot ;;
esac
exit 0

View File

@ -342,19 +342,19 @@ fi
# if NoPrompt is not used, ask user some questions
if [ $NO_PROMPT -ne 1 ]; then
echo "Do you want to edit the driver options file now? [y/N]"
printf "Do you want to edit the driver options file now? [y/N] "
read -r REPLY
echo
if [ "$REPLY" = y ] || [ "$REPLY" = Y ]; then
${TEXT_EDITOR} /etc/modprobe.d/${OPTIONS_FILE}
fi
case "$REPLY" in
[yY]*) ${TEXT_EDITOR} /etc/modprobe.d/${OPTIONS_FILE} ;;
esac
echo "Do you want to reboot now? (recommended) [y/N]"
printf "Do you want to reboot now? (recommended) [y/N] "
read -r REPLY
echo
if [ "$REPLY" = y ] || [ "$REPLY" = Y ]; then
reboot
fi
case "$REPLY" in
[yY]*) reboot ;;
esac
fi
exit 0

View File

@ -129,12 +129,12 @@ echo "You may now delete the driver directory if desired."
# if NoPrompt is not used, ask user some questions
if [ $NO_PROMPT -ne 1 ]; then
echo "Do you want to reboot now? (recommended) [y/N]"
printf "Do you want to reboot now? (recommended) [y/N] "
read -r REPLY
echo
if [ "$REPLY" = y ] || [ "$REPLY" = Y ]; then
reboot
fi
case "$REPLY" in
[yY]*) reboot ;;
esac
fi
exit 0