Make an array called array with three elements in it, a hashmap /dict / associative array called hash with three elements in it, and a string variable called str with at least 15 characters where one...





  1. Make an array called array with three elements in it, a hashmap /dict / associative array called hash with three elements in it, and a string variable called str with at least 15 characters where one of those characters is duplicated twice (i.e., in the string at least 3 times).


    hint:
    declare -a array #creates an index array &
    declare -A hash #creates an associative array




  2. Use echo to print both your arrays
    (both ‘array’ and ‘hash’)
    as strings on a single line.
    (Use loops)




  3. Save just a portion of your indexed array to a new array variable.




  4. Write a loop to print out each item of the new array on a line by itself.




  5. Remove the last element from your indexed array.




  6. Remove the first element from your index array.




  7. Use echo to print out your indexed array on a single line.




  8. Use an if statement to do this: If your array contains 2, print “true” otherwise print “false”




  9. Create a read-only string variable and demonstrate that it cannot be changed.




  10. Echo a substring of str which does not contain the first or last characters of str.




  11. Echo the last bit of str that does not contain the thrice-repeated character from step 1.




  12. Echo every part of str after the first instance of the thrice-repeated character.




  13. Write an expression that echoes the value of an unset variable, but have the parameter expansion replace the unset variable’s value with any value you want and assign the variable to this value.




  14. Echo the now-set variable from 13.





Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here