Skip to content

Instantly share code, notes, and snippets.

@biaocy
Last active May 1, 2022 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biaocy/4e78744d2a722384c668f7fa52ab7283 to your computer and use it in GitHub Desktop.
Save biaocy/4e78744d2a722384c668f7fa52ab7283 to your computer and use it in GitHub Desktop.
Generate random welcome message with cowsay and fortune
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
@biaocy
Copy link
Author

biaocy commented Apr 30, 2022

Dependecies:

sudo apt install cowsay fortune lolcat -y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment