Assignment 9

Task-A: Write a shell script to complete the following steps:

  1. Prompt the user to input his/her lucky number.
  2. If the input number is equal to 10, then print the message “You got the first prize.”
  3. If the input number is equal to 8, then print the message – “You got the second prize.”
  4. If the input number is equal to 999, then print the message – “You got the third prize.”
  5. If None of the above conditions are true, then print the message – “Sorry, good Luck for the next time.”

Task-B: Write a shell script to validate your input.

  1. Prompt the user to provide the username which should consists of characters and numbers both, and check if the following requirements are satisfied:
  2. Only lower-case letter [a-z] and numeric character [0-9] are allowed.
  3. The length must be between 4 to 8 digits

Test your script with the following inputs, and submit the screenshot for the script and all the Four outputs:

  1. Your input with one upper case
  2. The input has length less than 4 digits.
  3. The input has length larger than 8 digits.
  4. Your input in lower case and should have length between 4 to 8.

Leave a Reply

Your email address will not be published. Required fields are marked *