I need help figuring out how to run a bash alias or function that randomly chooses another command or alias and runs it.
the list of commands and aliases and function aliases is known beforehand. the size of list is also known.
I have multiple variations of an ascii art stored in aliases.
e.g. ascii-art-colorless-clear ascii-art-colorless-bg ascii-art-colored-clear ascii-art-colored-bg
I dont want to type the whole alias I just want to type ascii-art and have one of the aliases be chosen as random.
each alias is just a simple echo command in this case
EDIT: answer found with help from Gilles Quenot. function needed is select-random-arguement-to-run() { $(shuf -e "$@" -n 1) }
this will select a random alias and run it
alias ascii-art="select-random-arguement-to-run "ascii-art-colorless-clear" "ascii-art-colorless-bg" "ascii-art-colored-clear" "ascii-art-colored-bg""
which needs the select-random-arguement-to-run function defined previously to be in my bashrc file.