Advertisement
guenstigwerben

Fortune / Cowsay

Aug 5th, 2015
4,337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.31 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # This script gets a random available cow with `cowsay -l` and prints some text, default fortune
  4.  
  5. FORTUNE="fortune"
  6.  
  7. for COWNAME in `cowsay -l | tail -n +2`
  8. do
  9. COWS+=$COWNAME
  10. COWS+='\n'
  11. done
  12. COWS=${COWS%??}
  13. RANDOMCOW=$(echo -e $COWS | sort -R | head -n 1)
  14. $FORTUNE | cowsay -f $RANDOMCOW
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement