Question: If the user types in the command incorrectly then the program should end just like the example output. . The first script is validate. sh.

. The first script is validate. sh. This is a simple form validation script that will be used to verify the inputs given. Normally, this would be done to validate input from a website or another program before entry into a database or other record storage. In this case, we will keep it simple and only focus on the input validation step. In particular, the script should prompt the user for four values: first name, last name, zip code, and email address. Each input must be validated, meaning that the input conforms to a certain standard. Here is the standard for this assignment: The first name must start with a capital letter and contain only letters and hyphens. The last name must start with a capital letter and contain only letters and hyphens. The zip code must be exactly 5 digits and nothing else. The email address must be a valid email address format, meaning USER@DOMAIN, where both USER and DOMAIN must be only letters, numbers, dots, underscores, and hyphens. As the script reads each value, use regular expressions to ensure that the value matches the standard above. If a value does not match the standard, print an error message and exit immediately (don't prompt for the rest of the inputs). If all four values are validated successfully, then print a message indicating that fact. Here are some sample runs: [user@localhost lab3]$ ./validate.sh First name: R2-D2 First name must start with a capital letter and contain only letters and hyphens! [user@localhost lab3]$ ./validate.sh First name: Han Last name: SOLO Last name must start with a capital letter and contain only letters and hyphens! [user@localhost lab3]$ ./validate.sh First name: Han Last name: Solo Zip code: 12 parsecs Zip code must be exactly 5 digits! [user@localhost lab3]$ ./validate.sh First name: Han Last name: Solo Zip code: 12345 Email address: han.solo Email address must be USER@DOMAIN, where both USER and DOMAIN must be only letters, numbers, dots, underscores, and hyphens! [user@localhost lab3]$ ./validate.sh First name: Han Last name: Solo Zip code: 12345 Email address: han.solo@gmail.com Validated! [user@localhost lab3]$
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
