cowsay is a silly linux tool for displaying a cow saying given text in the terminal.
$ cowsay hello
fortune is a silly linux too for displaying a "random" quote in the terminal.
$ fortune
Both of these commands can be repeatedly ran in the terminal using watch e.g.
$ watch cowsay hello
$ watch fortune
Additionally these two commands can be combined so the cow says "random" quotes. By piping the output of fortune into cowsay.
$ fortune | cowsay
However a combination of the use of watch and piping the output of fortune into cowsay doesn't do anything.... i.e. hangs until the process is ended
$ watch fortune | cowsay
Does anyone know why?
cowsay is a program that generates ASCII art pictures of a cow with a message. It can also generate pictures using pre-made images of other animals, such as Tux the Penguin, the Linux mascot. It is written in Perl.
With watch fortune | cowsay
you are piping the output of watch fortune
into cowsay
. You want to watch
the value of fortune
piped to cowsay
so you should quote it so watch will get the whole command to execute as
watch 'fortune | cowsay'
This is because everything after |
is executed in a subshell. Try this:
$ watch "fortune | cowsay"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With