Last active
May 1, 2022 20:09
-
-
Save biaocy/4e78744d2a722384c668f7fa52ab7283 to your computer and use it in GitHub Desktop.
Generate random welcome message with cowsay and fortune
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 characters
function welcome() { | |
local cowfiles=($(cowsay -l | tail -n+2 | tr '\n' ' ')) | |
local last_idx_cowfiles=$(expr ${#cowfiles[@]} - 1 ) | |
local selected_cowfile=${cowfiles[$(shuf -i 0-$last_idx_cowfiles -n1)]} | |
fortune | cowsay -f $selected_cowfile | lolcat | |
} | |
welcome |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dependecies: