Skip to content

Instantly share code, notes, and snippets.

@xoner
Created May 8, 2015 10:33
Show Gist options
  • Save xoner/bdbcc4df74c95e5e62df to your computer and use it in GitHub Desktop.
Save xoner/bdbcc4df74c95e5e62df to your computer and use it in GitHub Desktop.
Random animals showing random quotes at your terminal
#!/bin/bash
# before running
# apt-get install cowsay fortune
COW_FILES_DIR="/usr/share/cowsay/cows/"
COW_FILE_ORDER=$(( (RANDOM %51) + 2))
RDM_COW_FILE=$(ls -l $COW_FILES_DIR | tail -n +$COW_FILE_ORDER | head -n 1 | awk '{print $9}')
RDM_COW_PATH="$COW_FILES_DIR$RDM_COW_FILE"
fortune | cowsay -f $RDM_COW_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment