#!/bin/bash # Generate a random number using date RANDOM=$(date +%s) EXCUSESARRAY=( "to visit Nosarobumeh in the hospital" "for some away screen time" "as I have a slight headache" "to take a rest" "for the next one hour" "for a bit to run some errands" ) # Sets the $randomExcuse variable function selectRandomExcuse { # To get the length of an array e.g EXCUSES in bash, we use ${#arrayName[@]} # so $RANDOM % (length of array) gives us a number from 0 - length of array # which we then use to index from the EXCUSESARRAY randomExcuse=${EXCUSESARRAY[$RANDOM % ${#EXCUSESARRAY[@]} ]} }