Source

bin / cowgen

Full commit
#!/bin/sh

COWPATH="/usr/share/cows"

[ $# -eq 1 -a -n "$1" ] || { echo "need one argument, name for the cow"; exit 1; }
! [ -f "$COWPATH/$1.cow" ] || { echo "$COWPATH/$1.cow already exists"; exit 1; }

echo "creating new cow $COWPATH/$1.cow"
sed '
1 i\
$the_cow = <<EOC;\
        $thoughts\
         $thoughts\
          $thoughts
s/\\/\\\\/g
$ a\
EOC
' | tee $COWPATH/$1.cow