Guest User

Untitled

a guest
Jun 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [[ "$email" =~ "^[A-Za-z0-9._%+-]+<b>@</b>[A-Za-z0-9.-]+<b>\.</b>[A-Za-z]{2,4}$" ]]
  4. then
  5. echo "This email address looks fine: $email"
  6. else
  7. echo "This email address is flawed: $email"
  8. fi
  9.  
  10. ######################################################################################################
  11.  
  12. if [ $# != 1 ]; then
  13. echo "Usage: $0 address"
  14. exit 1
  15. else
  16. ip=$1
  17. fi
  18.  
  19. if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
  20. echo "Looks like an IPv4 IP address"
  21. elif [[ $ip =~ ^[A-Fa-f0-9:]+$ ]]; then
  22. echo "Could be an IPv6 IP address"
  23. else
  24. echo "oops"
  25. fi
Add Comment
Please, Sign In to add comment