Here\’s something that I saw on commandlinefu yesterday. That sent me thinking about some command to have the cow file picked randomly 🙂 So, here\’s the original command from the commandlinefu:
1
|
<td>
<div class="text codecolorer">
$ fortune | <a class="zem_slink freebase/en/cowsay" title="Cowsay" rel="homepage" href="http://www.nog.net/%7Etony/warez/cowsay.shtml">cowsay</a> -f tux
</div>
</td>
</tr>
</table>
by David Winterbottom (codeinthehole.com)
Now, for some fun
#!/bin/bash –
#===============================================================================
#Â Â Â Â Â Â Â Â Â FILE:Â fortune_cowsay.sh
#Â Â Â Â Â Â Â Â USAGE:Â ./fortune_cowsay.sh
#  DESCRIPTION: Cowsay with random cow file.. 🙂
#      OPTIONS: —
# REQUIREMENTS: —
#         BUGS: —
#        NOTES: —
#Â Â Â Â Â Â Â AUTHOR:Â Â (),
#Â Â Â Â Â Â COMPANY:
#Â Â Â Â Â Â VERSION:Â 1.0
#Â Â Â Â Â Â CREATED:Â 06/01/2010 03:25:59 PM IST
#     REVISION: —
#===============================================================================
array=( `ls -1 /usr/share/cowsay/ |tr ’\n’ ’ ’` )
count=${#array}
random=$((RANDOM%count))
fortune |cowsay -f ${array[$random]%%.cow}<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://pittsburgh.metblogs.com/2010/04/26/big-bens-statement-fortune-cookie-version/">Big Ben’s statement…fortune cookie version (pittsburgh.metblogs.com) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/05/12/get-the-most-favourite-commands-from-commandlinefu/">Get the most favourite commands from commandlinefu (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://teabreak.pk/some-questions-and-their-answers-178/35194/">Some questions and their answers… (teabreak.pk) <li class="zemanta-article-ul-li"><a href="http://bipolarsoupkitchen-stephany.blogspot.com/2010/05/fortune-cookie-wisdom.html">fortune cookie wisdom (bipolarsoupkitchen-stephany.blogspot.com) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/af1138ca-bee5-428a-8b0c-0263e1a4b095/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b94.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">