SHARE
TWEET

Fortune / Cowsay

guenstigwerben Aug 5th, 2015 2,464 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top