Difference between revisions of "OPS435 Lab 7 - Bash"

From CDOT Wiki
Jump to: navigation, search
(Created page with 'Create an array with every lowercase letter of the alphabet as an element, 25 total. You may hard-code the values in your script. Write a function that will receive as a paramet…')
(No difference)

Revision as of 21:13, 30 March 2016

Create an array with every lowercase letter of the alphabet as an element, 25 total. You may hard-code the values in your script.

Write a function that will receive as a parameter a random number between 0 and 24, and will print to the terminal the first letters from the array, but in uppercase.

If the number is 0 - it will print A. If the number is 5 - it will print ABCDE. If the parameter is 24 - it will print the entire alphabet.

You can use the modulus operator and the $RANDOM environment variable to get the random number you need.