Last active
March 19, 2021 12:47
-
-
Save deven96/e4c292562a7c3a58f9fdd1d2f8f8fd22 to your computer and use it in GitHub Desktop.
Revisions
-
deven96 revised this gist
Mar 19, 2021 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash # Generate a random number using date RANDOM=$(date +%s) EXCUSESARRAY=( "to visit Nosarobumeh in the hospital" @@ -10,7 +10,11 @@ EXCUSESARRAY=( "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[@]} ]} } -
deven96 revised this gist
Mar 19, 2021 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,4 +8,9 @@ EXCUSESARRAY=( "to take a rest" "for the next one hour" "for a bit to run some errands" ) # this sets the $randomExcuse variable function selectRandomExcuse { randomExcuse=${EXCUSESARRAY[$RANDOM % ${#EXCUSESARRAY[@]} ]} } -
deven96 created this gist
Mar 19, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ #!/bin/bash # Seed random generator 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" )