translated

This commit is contained in:
geekpi 2021-11-23 08:46:39 +08:00
parent 2ad57b9caa
commit 425807acd9
2 changed files with 179 additions and 178 deletions

View File

@ -1,178 +0,0 @@
[#]: subject: "3 interesting ways to use the Linux cowsay command"
[#]: via: "https://opensource.com/article/21/11/linux-cowsay-command"
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
3 interesting ways to use the Linux cowsay command
======
Want a just-for-fun application to play with? Try cowsay.
![Cow on parade.][1]
Most of the time, a terminal is a productivity powerhouse. But there's more to the terminal than commands and configurations. Among all the outstanding open source software out there, some of it has been [written just for fun][2]. I've written about [fun commands][3] before, but this article is about just one: the venerable `cowsay` command.
Cowsay is a configurable talking (or thinking) cow. It accepts a text string and outputs a graphic of a cow talking. Here's a cow saying it loves Linux:
```
< I love Linux >
\--------------
       \   ^__^
        \  (oo)\\_______
           (__)\       )\/\
               ||----w |
               ||     ||
```
To get that result, all I have to type is:
`$ cowsay "I love Linux"`
### Install cowsay on Linux
You can install cowsay with your package manager. On Debian, Mint, Elementary, and similar distributions:
`$ sudo apt install cowsay`
On Fedora:
`$ sudo apt install cowsay-beefymiracle`
### Cowsay command options
Cowsay is a simple and silly application. There's no actual use for it except to provide some diverting styling for your terminal. For instance, rather than just making a cow say a fun phrase, you can make a cow with wonky eyes say a fun phrase. Type:
`$ cowsay -e @@ Hello`
You'll get:
```
< Hello >
 -------
       \   ^__^
        \  (@@)\\_______
           (__)\       )\/\
               ||----w |
               ||     ||
```
Or you can make it stick out its tongue. Type:
`$ cowsay -T U Hello`
You'll see:
```
< Hello >
\-------
       \   ^__^
        \  (oo)\\_______
           (__)\       )\/\
            U ||----w |
               ||     ||
```
Better still, you can combine the `fortune` command with `cowsay`:
`$ fortune | cowsay`
Now you'll have an especially smart cow:
```
 _______________________________________
/ we:                                   \
|                                       |
| The single most important word in the |
\ world.                                /
 ---------------------------------------
       \   ^__^
        \  (oo)\\_______
           (__)\       )\/\
               ||----w |
               ||     ||
```
### Beefy miracle
On Fedora, there's an extra option for cowsay that's also an unofficial project mascot. For years, the Fedora installer has displayed slides promoting open source contributions. Because they were styled after the interludes at drive-in movie theaters, a common cartoon character in the slides is an anthropomorphic hot dog.
In keeping with that theme, you can invoke a so-called beefy miracle with the Fedora version of cowsay:
`$ cowsay -f beefymiracle Hello Fedora`
You'll end up with a perfectly silly result:
```
< Hello Fedora >
 --------------      .---. __
          ,    \    /     \   \    ||||
         \\\\\\\      |O___O |    | \\\||||
         \   //    | \\_/  |    |  \   /
          '--/----/|     /     |   |-'
                 // //  /     -----'
                //  \\\ /      /
               //  // /      /
              //  \\\ /      /
             //  // /      /
            /|   ' /      /
            //\\___/      /
           //   ||\     /
           \\\\_  || '---'
           /' /  \\\\_.-
          /  /    --| |
          '-'      |  |
                    '-'
```
### Graphical cowsay
If you find yourself needing to have messages delivered to you from a graphical cow, there's the `xcowsay` command. It's a graphical program similar to cowsay, and it accepts a text string that's entered by the user or piped from another application like Fortune.
![A cartoon cow has a speech bubble that reads "I love Linux"][4]
Don Watkins, [CC BY-SA 4.0][5]
### Fun Linux commands
While `cowsay` is not a useful command, it is a fun command—the equivalent of desktop widgets for your terminal. It's great for a momentary distraction and fun experiments with piping commands (try piping `ifconfig` to cowsay, or `lsblk`, or `mount`, or anything!). If you want to make your terminal more fun, try cowsay.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/11/linux-cowsay-command
作者:[Don Watkins][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_CowParade_osdc.png?itok=6GD1Wnbm (Cow on parade.)
[2]: https://opensource.com/life/16/6/fun-and-semi-useless-toys-linux
[3]: https://opensource.com/article/21/11/fun-linux-commands
[4]: https://opensource.com/sites/default/files/uploads/graphical_cowsay.png (graphical cowsay)
[5]: https://creativecommons.org/licenses/by-sa/4.0/

View File

@ -0,0 +1,179 @@
[#]: subject: "3 interesting ways to use the Linux cowsay command"
[#]: via: "https://opensource.com/article/21/11/linux-cowsay-command"
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
使用 Linux cowsay 命令的 3 种有趣方式
======
想试一个只是好玩的应用吗?试试 cowsay。
![Cow on parade.][1]
大多数时候,终端是一个生产力的动力源。但是,终端的作用不止是命令和配置。在所有杰出的开源软件中,有些是[为了好玩而写的][2]。我以前写过一些[有趣的命令][3],但这篇文章只讲一个:古老的 `cowsay` 命令。
cowsay 是一只可配置的会说话(或思考)的牛。它接受一个文本字符串,并输出一个牛说话的图形。下面是一头牛在说它喜欢 Linux
```
< I love Linux >
\--------------
\ ^__^
\ (oo)\\_______
(__)\ )\/\
||----w |
|| ||
```
要得到这个结果,我只需输入:
`$ cowsay "I love Linux"`
### 在 Linux 上安装 cowsay
你可以用你的包管理器安装 cowsay。在 Debian、Mint、Elementary 和类似的发行版上:
`$ sudo apt install cowsay`
在 Fedora 上:
`$ sudo apt install cowsay-beefymiracle`
### Cowsay 命令选项
cowsay 是一个简单又有点傻的应用。除了为你的终端机提供一些不同样式外,它并没有什么实际用途。例如,与其让一头普通的牛说一个有趣短语,你可以让一头长着古怪眼睛的牛说一个有趣的短语。输入:
`$ cowsay -e @@ Hello`
你会得到:
```
< Hello >
-------
\ ^__^
\ (@@)\\_______
(__)\ )\/\
||----w |
|| ||
```
或者你可以让它伸出舌头。输入:
`$ cowsay -T U Hello`
你会看到:
```
< Hello >
\-------
\ ^__^
\ (oo)\\_______
(__)\ )\/\
U ||----w |
|| ||
```
更好的是,你可以将 `fortune` 命令与 `cowsay` 结合起来:
`$ fortune | cowsay`
现在你会有一头特别聪明的牛:
```
_______________________________________
/ we: \
| |
| The single most important word in the |
\ world. /
---------------------------------------
\ ^__^
\ (oo)\\_______
(__)\ )\/\
||----w |
|| ||
```
### 结实的奇迹
在 Fedora 上,有一个额外的 cowsay 选项也是一个非官方的项目吉祥物。多年来Fedora 安装程序一直在展示宣传开源贡献的幻灯片。因为它们是根据汽车电影院的插曲设计的,所以幻灯片中常见的卡通人物是拟人化的热狗。
为了与这个主题保持一致,你可以用 Fedora 版本的 cowsay 调用一个所谓的结实的奇迹beefy miracle
`$ cowsay -f beefymiracle Hello Fedora`
你会得到一个非常傻的输出:
```
< Hello Fedora >
-------------- .---. __
, \ / \ \ ||||
\\\\\\\ |O___O | | \\\||||
\ // | \\_/ | | \ /
'--/----/| / | |-'
// // / -----'
// \\\ / /
// // / /
// \\\ / /
// // / /
/| ' / /
//\\___/ /
// ||\ /
\\\\_ || '---'
/' / \\\\_.-
/ / --| |
'-' | |
'-'
```
### 图形化的 cowsay
如果你发现自己需要用图形化的牛来传递信息,可以使用 `xcowsay` 命令。这是一个类似于 cowsay 的图形程序,它接受一个由用户输入的文本字符串,或从另一个应用(如 Fortune输送过来的文本字符串。
![A cartoon cow has a speech bubble that reads "I love Linux"][4]
Don Watkins[CC BY-SA 4.0][5]
### 有趣的 Linux 命令
虽然 `cowsay` 不是一个有用的命令,但它是一个有趣的命令,相当于你终端的桌面小工具。它很适合用来分散注意力和进行有趣的管道命令实验(尝试将 `ifconfig` 管道到 cowsay`lsblk``mount`,或任何东西!)。如果你想让你的终端更有趣,试试 cowsay。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/11/linux-cowsay-command
作者:[Don Watkins][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_CowParade_osdc.png?itok=6GD1Wnbm (Cow on parade.)
[2]: https://opensource.com/life/16/6/fun-and-semi-useless-toys-linux
[3]: https://opensource.com/article/21/11/fun-linux-commands
[4]: https://opensource.com/sites/default/files/uploads/graphical_cowsay.png (graphical cowsay)
[5]: https://creativecommons.org/licenses/by-sa/4.0/