zoukankan      html  css  js  c++  java
  • linux命令之cowsay

    最近无聊的时候在学习ansible,在看«奔跑吧Ansible»这本书的时候,了解到这个命令,感觉和ansible搭配很好玩,于是就开始安装一下。

    dnf install cowsay

    简单使用:

    [root@ansible cowsay]# cowsay hellow world!
     _______________
    < hellow world! >
     ---------------
               ^__^
               (oo)\_______
                (__)       )/
                    ||----w |
                    ||     ||
    [root@ansible cowsay]#
    

    查询所有能用动物

    root@ansible ~]# cowsay -l
    Cow files in /usr/share/cowsay:
    beavis.zen blowfish bud-frogs bunny cheese cower default dragon
    dragon-and-cow elephant elephant-in-snake eyes flaming-sheep ghostbusters
    head-in hellokitty kiss kitty koala kosh luke-koala mech-and-cow meow milk
    moofasa moose mutilated ren sheep skeleton small stegosaurus stimpy
    supermilker surgery telebears three-eyes turkey turtle tux udder vader
    vader-koala www
    [root@ansible ~]# cd /usr/share/cowsay
    [root@ansible cowsay]# ll
    总用量 204
    -rw-r--r--. 1 root root  584 6月  25 2016 beavis.zen.cow
    -rw-r--r--. 1 root root  639 6月  25 2016 blowfish.cow
    -rw-r--r--. 1 root root  310 6月  25 2016 bud-frogs.cow
    -rw-r--r--. 1 root root  123 6月  25 2016 bunny.cow
    -rw-r--r--. 1 root root  480 6月  25 2016 cheese.cow
    -rw-r--r--. 1 root root  230 6月  25 2016 cower.cow
    -rw-r--r--. 1 root root  175 6月  25 2016 default.cow
    -rw-r--r--. 1 root root 1284 6月  25 2016 dragon-and-cow.cow
    -rw-r--r--. 1 root root 1527 6月  25 2016 DragonAndCow.pm
    -rw-r--r--. 1 root root 1000 6月  25 2016 dragon.cow
    -rw-r--r--. 1 root root  284 6月  25 2016 elephant.cow
    -rw-r--r--. 1 root root  295 6月  25 2016 elephant-in-snake.cow
    -rw-r--r--. 1 root root 3038 6月  25 2016 Example.pm
    -rw-r--r--. 1 root root  585 6月  25 2016 eyes.cow
    -rw-r--r--. 1 root root  490 6月  25 2016 flaming-sheep.cow
    -rw-r--r--. 1 root root  712 6月  25 2016 Frogs.pm
    -rw-r--r--. 1 root root 1018 6月  25 2016 ghostbusters.cow
    -rw-r--r--. 1 root root  257 6月  25 2016 head-in.cow
    -rw-r--r--. 1 root root  126 6月  25 2016 hellokitty.cow
    -rw-r--r--. 1 root root  637 6月  25 2016 kiss.cow
    -rw-r--r--. 1 root root  296 6月  25 2016 kitty.cow
    -rw-r--r--. 1 root root  162 6月  25 2016 koala.cow
    -rw-r--r--. 1 root root  406 6月  25 2016 kosh.cow
    -rw-r--r--. 1 root root  225 6月  25 2016 luke-koala.cow
    -rw-r--r--. 1 root root  941 5月  22 21:38 mech-and-cow.cow
    -rw-r--r--. 1 root root 1183 6月  25 2016 MechAndCow.pm
    -rw-r--r--. 1 root root  473 6月  25 2016 meow.cow
    -rw-r--r--. 1 root root  439 6月  25 2016 milk.cow
    -rw-r--r--. 1 root root  242 6月  25 2016 moofasa.cow
    -rw-r--r--. 1 root root  203 6月  25 2016 moose.cow
    -rw-r--r--. 1 root root  201 6月  25 2016 mutilated.cow
    -rw-r--r--. 1 root root  252 6月  25 2016 ren.cow
    -rw-r--r--. 1 root root  234 6月  25 2016 sheep.cow
    -rw-r--r--. 1 root root  433 6月  25 2016 skeleton.cow
    -rw-r--r--. 1 root root  194 6月  25 2016 small.cow
    -rw-r--r--. 1 root root  854 6月  25 2016 stegosaurus.cow
    -rw-r--r--. 1 root root 1193 6月  25 2016 Stegosaurus.pm
    -rw-r--r--. 1 root root  364 6月  25 2016 stimpy.cow
    -rw-r--r--. 1 root root  280 6月  25 2016 supermilker.cow
    -rw-r--r--. 1 root root  892 6月  25 2016 surgery.cow
    -rw-r--r--. 1 root root  333 6月  25 2016 telebears.cow
    -rw-r--r--. 1 root root 3624 6月  25 2016 TextBalloon.pm
    -rw-r--r--. 1 root root  293 6月  25 2016 three-eyes.cow
    -rw-r--r--. 1 root root 1302 6月  25 2016 turkey.cow
    -rw-r--r--. 1 root root 1105 6月  25 2016 turtle.cow
    -rw-r--r--. 1 root root  215 6月  25 2016 tux.cow
    -rw-r--r--. 1 root root 1134 6月  25 2016 TuxStab.pm
    -rw-r--r--. 1 root root  392 6月  25 2016 udder.cow
    -rw-r--r--. 1 root root  279 6月  25 2016 vader.cow
    -rw-r--r--. 1 root root  213 6月  25 2016 vader-koala.cow
    -rw-r--r--. 1 root root  248 6月  25 2016 www.cow
    

    指定某个动物:

    [root@ansible cowsay]# cowsay -f kitty hellow world!
     _______________
    < hellow world! >
     ---------------
         
          
           ("`-'  '-/") .___..--' ' "`-._
             ` *_ *  )    `-.   (      ) .`-.__. `)
             (_Y_.) ' ._   )   `._` ;  `` -. .-'
          _.. `--'_..-_/   /--' _ .' ,4
       ( i l ),-''  ( l i),'  ( ( ! .-'
    [root@ansible cowsay]#
    

    安装fortune,csdn积分下载

    [root@ansible ~]# ll
    总用量 1612
    -rw-------. 1 root root    1187 7月   5 21:35 anaconda-ks.cfg
    -rw-r--r--. 1 root root 1116792 7月  10 01:13 fortune-mod-1.99.1-17.sdl7.x86_64.rpm
    -rwxr--r--. 1 root root     113 7月   5 23:56 key.sh
    -rw-r--r--. 1 root root  522820 7月  10 01:19 librecode-3.6-alt11.1.1.x86_64.rpm
    [root@ansible ~]# rpm -ivh librecode-3.6-alt11.1.1.x86_64.rpm
    Verifying...                          ################################# [100%]
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:librecode-3.6-alt11.1.1          ################################# [100%]
    [root@ansible ~]# rpm -ivh fortune-mod-1.99.1-17.sdl7.x86_64.rpm
    警告:fortune-mod-1.99.1-17.sdl7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 41a40948: NOKEY
    Verifying...                          ################################# [100%]
    准备中...                          ################################# [100%]
    正在升级/安装...
       1:fortune-mod-1.99.1-17.sdl7       ################################# [100%]
    [root@ansible ~]# fortune | cowsay -f kiss
     _________________________________________
    / Let the worthy citizens of Chicago get  
    | their liquor the best way they can. I'm |
    | sick of the job. It's a thankless one   |
    | and full of grief.                      |
    |                                         |
     -- Al Capone                            /
     -----------------------------------------
         
          
                 ,;;;;;;;,
                ;;;;;;;;;;;,
               ;;;;;'_____;'
               ;;;(/))))|((
               _;;((((((|))))
              / |_\\\\\\
         .--~(   ~))))))))))))
        /       `-(((((((((((\
        |    | `   ) |       /|)
         |    |  `. _/  \_____/ |
          |    , `~            /
           |                 /
          | `.   `|          /
          |   ~-   `        /
           \____~._/~ -_,   (
            |-----|       ';;
           |      | :;;;'     
          |  /    |            |
          |       |            |
    [root@ansible ~]#
    

    写了一个简单shell

    [root@ansible ~]# cat cowsay.sh
    #!bin/bash
    
    # call cowsay after login
    animal=$(ls  /usr/share/cowsay | shuf -n 1)
    str=${animal%.*}
    # pass sentence to cowsay with random animal
    fortune | cowsay -f $str
    [root@ansible ~]# sh cowsay.sh
     _______________________________________
    / The most important design issue... is 
    | the fact that Linux is supposed to be |
    | fun...                                |
    |                                       |
    | -- Linus Torvalds at the First Dutch  |
     International Symposium on Linux      /
     ---------------------------------------
      
          \_\_    _/_/
              \__/
               (oo)\_______
               (__)       )/
                   ||----w |
                   ||     ||
    [root@ansible ~]# sh cowsay.sh
     _______________________________________
    / Do your otters do the shimmy? Do they 
    | like to shake their tails? Do your    |
    | wombats sleep in tophats? Is your     |
     garden full of snails?                /
     ---------------------------------------
       
        
          _____   _________
         /     \_/         |
        |                 ||
        |                 ||
       |    ###  /###   | |
       |     0  /  0    | |
      /|                 | |
     / |        <        | 
    | /|                 | | |
    | |     \_______/   |  | |
    | |                 | / /
    /||                 /|||
       ----------------|
            | |    | |
            ***    ***
           /___  /___
    [root@ansible ~]#
    
    

    把sh放到/etc/profile.d

  • 相关阅读:
    从B树、B+树、B*树谈到R 树
    平衡二叉树、B树、B+树、B*树
    数据库事务和四种隔离级别
    python 安装surprise库解决 c++tools错误问题
    python的sorted函数
    爬虫出现gbk错误
    Windows下Python安装numpy+mkl,Scipy和statsmodels
    Flask--框架及路由
    flask常见面试题
    RE正则表达式
  • 原文地址:https://www.cnblogs.com/dalianpai/p/13277226.html
Copyright © 2011-2022 走看看