From b3122a2c2e3f4fe1f4d24b9d95b9e32319ba481d Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 26 Aug 2018 04:13:54 -0400 Subject: [PATCH] abstract name checked to regex --- mutt-wizard.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mutt-wizard.sh b/mutt-wizard.sh index be166b4..2bff580 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -145,7 +145,11 @@ $serverinfo EOF fi realname=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Enter the full name you'd like to be identified by on this email account." 10 60 3>&1 1>&2 2>&3 3>&- ) -title=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Give a short, one-word name for this email account that will differentiate it from other email accounts." 10 60 3>&1 1>&2 2>&3 3>&- ) +title=$(dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Give a short, one-word name for this email account that will differentiate it from other email accounts." 10 60 3>&1 1>&2 2>&3 3>&1) || exit +namere="^[a-z_][a-z0-9_-]*$" +while ! [[ "${title}" =~ ${namere} ]]; do + title=$(dialog --no-cancel --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Account title not valid. Give a username beginning with a letter, with only lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1) +done login=$(dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "If you have a username for the \"$title\" account which is different from your email address, enter it here. Otherwise leave this prompt blank." 10 60 3>&1 1>&2 2>&3 3>&- ) # Sets the repo type and other variables for the sed regex. if [[ "$service" == "gmail.com" ]];