Skip to content

Commit

Permalink
Merge pull request #234 from iAGorynT/iAGorynT-Code-Snippet-Changes
Browse files Browse the repository at this point in the history
Update zUserinput.sh
  • Loading branch information
iAGorynT authored Dec 5, 2023
2 parents 4fbcf7f + ec40707 commit 67b2a1e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ShellScripts/zTests/zUserinput.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,24 @@ validate_phone_number() {
# local regex="^\([0-9]{3}\) [0-9]{3}-[0-9]{4}$"
if [[ $phone_number =~ $regex ]]; then
echo "Valid phone number: $phone_number"
retval=0
else
echo "Invalid phone number: $phone_number"
retval=1
fi
return "$retval"
}
while true; do
# Enter Phone Number
echo "Format: (XXX) XXX-XXXX, XXX-XXX-XXXX, or XXX XXX XXXX"
read phone_number\?"Enter Phone Number: "
validate_phone_number $phone_number
echo "Format: (XXX) XXX-XXXX, XXX-XXX-XXXX, or XXX XXX XXXX"
read phone_number\?"Enter Phone Number: "
validate_phone_number $phone_number
# Valid Phone Number - Exit Do While...
if [ "$retval" = 0 ]; then
break
else
echo
fi
done
echo

0 comments on commit 67b2a1e

Please sign in to comment.