Browse Source

Merge pull request #28 from GReagle/simplify-status

simplify: no need for STATUS variable
Siddharth Dushantha 5 năm trước cách đây
mục cha
commit
11b304f6bb
1 tập tin đã thay đổi với 3 bổ sung6 xóa
  1. 3 6
      tmpmail

+ 3 - 6
tmpmail

@@ -106,12 +106,9 @@ generate_email_address() {
         # Do a regex check to see if the email address provided by the user is a
         # valid email address
         REGEXP="[a-z0-9]+@1secmail\.(com|net|org)"
-        printf "%b" "$EMAIL_ADDRESS" | grep -E "$REGEXP" >/dev/null
-
-        # Get the exit status of the command above
-        STATUS=$?
-
-        [ "$STATUS" -ne 0 ] && print_error "Provided email is invalid. Must match $REGEXP"
+        if ! printf %b "$EMAIL_ADDRESS" | grep -Eq "$REGEXP"; then
+            print_error "Provided email is invalid. Must match $REGEXP"
+        fi
     fi
 
     # Save the generated email address to the $TMPMAIL_EMAIL_ADDRESS file