Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have installed cowsay and fortune. I want to set my own talks or texts in cowsay. But I can't configure it out. When i open terminal there is nothing from cowsay. I want to show cowsay when I start terminal.

But this works:

hash@ssl50:~$ cowsay -f tux "Carry on"

< carry on >
----------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\
    \___)=(___/
share|improve this question
add comment

4 Answers

I'm having difficulties understanding your question, but if you want to combine cowsay and fortune, to present you with a message each time you start a terminal, add the following line:

fortune | cowsay -f tux

to the file .bashrc in your home folder.

Package shortcuts: cowsayInstall cowsay fortuneInstall fortune

share|improve this answer
add comment

I used the first two answers and the man page to get a turtle's random thought's.

  1. Found the cowsay -l switch to list all of the cowfiles.
  2. After finding the turtle, I edited my ~/.bashrc.

    fortune | cowsay -f turtle
    

P.S. I suggest that your first step is.

$ sudo apt-get install fortune-mod fortunes-ubuntu-server fortunes-off fortunes-bofh-excuses fortunes-debian-hints fortunes-spam cowsay

That way you will have plenty of fortunes. These fortunes also come in handy if you have "Wanda the wise Gnome fish" installed / possibly set to autoRun.

Also a great fortune set is the mint fortunes-husse.deb package. So either find the .deb file on-line via a quick Google or add the Mint repositories to Ubuntu.

share|improve this answer
add comment

Well, in Linux Mint there is a fun thing you could do: write a script to select a cow and display a message from fortune. I'll get to it later. Once you have the script, all you have to do is to execute it. As suggested before, edit your ~/.bashrc file and add at the end a line containing the path to your script. For example, if you have the script in your home folder and the script's filename is "cowscript", then you could add the following line at the end of your ~/.bashrc file:

$HOME/cowscript

Now, the script used in Linux Mint 9 is the following:

#!/bin/bash
RANGE=4

number=$RANDOM
let "number %= $RANGE"
case $number in
    0)
        cow="small"
        ;;
    1)
        cow="tux"
        ;;
    2)
        cow="koala"
        ;;
    3)
        cow="moose"
        ;;
esac

RANGE=2
number=$RANDOM
let "number %= $RANGE"
case $number in
    0)
        command="/usr/games/cowsay"
        ;;
    1)
        command="/usr/games/cowthink"
        ;;
esac
/usr/games/fortune | $command -f $cow

Basically, it will display a random cow (either small, tux, koala, or moose) and the message will be taken from fortune. Also, this script will execute wither cowsay or cowthink, the only difference being that cowthink will display a thinking cow instead of a talking cow.

Now, the fun thing is that you can modify the script to show more cows or to show different cows. To do that, you first need to know what cows you have installed. In a terminal, run:

cowsay -l

You can use any of those cows. All you have to do is to edit the script: if you want to add a new cow, just copy the lines containing "cow" (plus the number and semi-colons) and paste them before the line that says "esac". Then, change the number and name of the cow, so for instance, if you want to add a cow called "udder", all you have to do is to add these lines before the first "esac":

4)
    cow="udder"
    ;;

Important: the second line of the file, "RANGE=4", must be changed also. If you add one cow, then instead of 4 use 5, also if you delete one cow, then you must use 3, and so on. Also note that the numbers that you see must be in the range from 0 to RANGE - 1. That's why RANGE is 4 and the numbers are 0, 1, 2, and 3.

You could also create your own cows, although that might take a bit more of work. All you have to do is to get any ASCII art you like and edit it, but it is a bit tricky. You can see how it's done here: http://lmpeiris.wordpress.com/2011/01/17/cowsayhow-to-make-a-cow-talk-on-terminal-startup/ However, consider that any @ and \ symbols need to be backslashed, that is, you must put before that symbol this other symbol: \. This might be the case for #, too (but not always). If your ASCII Art contains #, you could backslash it too, but sometimes it would be enough with just one of them... I'm not sure how to explain it, sorry. I guess you will have to try to see if it works. Also, make sure that the file you edit has the extension ".cow"

Finally, once you have your own cows, you can either add them to the default location (you probably will need to be superuser for that) at /usr/share/cowsay/cows, or you could add to your ~/.bashrc file this lines:

export COWPATH="/usr/share/cowsay/cows"
# set COWPATH so it includes user's cows
if [ -d "$HOME/cowfiles" ] ; then
    COWPATH="$COWPATH:$HOME/cowfiles"
fi

Be sure to add those lines before you call your "cowscript". This also assumes that you have a folder called "cowfiles" on your home folder. Change the path if you want so it points to the folder where you have your cowfiles.

share|improve this answer
add comment

Well the right command is:

root@bt:~# cowsay -f tux "hello my name is ubuntu"

More info can be found here.

share|improve this answer
1  
This answer just duplicates what's already in the question. -1 –  Scott Severance Sep 27 '12 at 4:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.