Donnerstag, 6. März 2014

A storytelling cow in the Bash Console using Fortune and Cowsay

you'll need 'cowsay' and 'fortune', both in the debian default repositories:

sudo apt-get install cowsay fortune

#!/usr/bin/bash

while (true); do
      text=$(fortune); 
      cowsay $text;
      length=$(echo $text | wc -w);
      let length=$(expr $length);
      sleep $length;
done;


sample output:

user@machine:~$ sh cowsayloop.sh


Keine Kommentare:

Kommentar veröffentlichen