Last active
October 5, 2021 06:52
-
-
Save Montandalar/679f8a0695bc71322ee8b15a0067cd65 to your computer and use it in GitHub Desktop.
Create random modern art with fortune and cowsay
This file contains 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
#!/bin/sh | |
cows=$(ls /usr/share/cowsay/cows) | |
nCows=$(ls -1 /usr/share/cowsay/cows/ | wc -l) | |
x=$(head -c1 /dev/random | hexdump -e '"%d"') | |
nChoice=$((($x*$nCows)/255)) | |
choice=$(ls -1 /usr/share/cowsay/cows/ | sed -n ${nChoice}s/.\cow$//p) | |
fortune | cowsay -f $choice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment