mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-10 22:21:11 +08:00
translated
This commit is contained in:
parent
6cfd358722
commit
49677eb9c0
@ -1,79 +0,0 @@
|
||||
[#]: subject: "Use the Linux cowsay command for a colorful holiday greeting"
|
||||
[#]: via: "https://opensource.com/article/21/11/linux-cowsay"
|
||||
[#]: author: "Alan Formy-Duval https://opensource.com/users/alanfdoss"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "unigeorge"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Use the Linux cowsay command for a colorful holiday greeting
|
||||
======
|
||||
Celebrate the Day of the Dead using this fun Linux command-line tool.
|
||||
![Pumpkins painted for Day of the Dead][1]
|
||||
|
||||
You may have heard of a small program that takes input, such as a message that you type, and outputs a picture of a cow quoting your message. It is called **cowsay**. It has been written about before here on [Opensource.com][2].
|
||||
|
||||
So, to have a little fun with it, I thought I'd use it to celebrate Día de los Muertos (Day of the Dead).
|
||||
|
||||
In addition to a cow, there are other images available. When you install `cowsay` it includes several other images, which the install stores in `/user/share/cowsay`. You can use the `-l` argument to get a list.
|
||||
|
||||
|
||||
```
|
||||
$ sudo dnf install cowsay
|
||||
$ cowsay -l
|
||||
```
|
||||
|
||||
There's actually quite a bit of development activity related to `cowsay` and similar programs. It is possible to create your own image files or download images others have made. For instance, [Charc0al's cowsay file converter][3] is located on GitHub. You can use this tool to convert your own pictures to the special ASCII format file required by `cowsay`. Depending on your Linux or FreeBSD terminal settings, you may have color support enabled. The `cowsay` utility can display color images, as well. Charc0al's converter provides many ready-to-go color files.
|
||||
|
||||
I chose to use the Beetlejuice file for my celebration. First, I saved the [beetlejuice.cow][4] file to `/usr/share/cowsay`. This directory is owned by root, so you may have to save the file to your home directory first and then copy it. I also needed to give all users read access.
|
||||
|
||||
|
||||
```
|
||||
$ sudo cp beetlejuice.cow /usr/share/cowsay
|
||||
$ sudo chmod o+r /usr/share/cowsay/beetlejuice.cow
|
||||
```
|
||||
|
||||
It is interesting to notice how the image is generated. The top sets various ASCII color control codes to variables. These variables are then used to draw the image in the traditional ASCII art style. The image is almost full-body and did not fit my terminal height without scrolling off the screen, so I edited the file and removed the last 15 lines to shorten it.
|
||||
|
||||
The image is also detected by the `cowsay` program and appears in the list.
|
||||
|
||||
|
||||
```
|
||||
$ cowsay -l
|
||||
Cow files in /usr/share/cowsay:
|
||||
beavis.zen beetlejuice blowfish bud-frogs bunny cheese cower default dragon
|
||||
...
|
||||
```
|
||||
|
||||
Now, simply run the program and specify the image using the `-f` option. Don't forget to provide a message.
|
||||
|
||||
|
||||
```
|
||||
`$ cowsay -f beetlejuice "Happy Day of the Dead!"`
|
||||
```
|
||||
|
||||
![ASCII display of Beetlejuice via cowsay][5]
|
||||
|
||||
Beetlejuice says Happy Day of the Dead (CC BY-SA 4.0)
|
||||
|
||||
The `cowsay` command is just another way to have some command-line fun with your Linux computer. Experiment with `cowsay` and ASCII art—get creative.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/11/linux-cowsay
|
||||
|
||||
作者:[Alan Formy-Duval][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/unigeorge)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/alanfdoss
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/drew-hays-unsplash.jpg?itok=uBrvJkTW (Pumpkins painted for Day of the Dead)
|
||||
[2]: https://opensource.com/article/18/12/linux-toy-cowsay
|
||||
[3]: https://charc0al.github.io/cowsay-files/converter/
|
||||
[4]: https://raw.githubusercontent.com/charc0al/cowsay-files/master/cows/beetlejuice.cow
|
||||
[5]: https://opensource.com/sites/default/files/cowsay_beetlejuice.png
|
@ -0,0 +1,75 @@
|
||||
[#]: subject: "Use the Linux cowsay command for a colorful holiday greeting"
|
||||
[#]: via: "https://opensource.com/article/21/11/linux-cowsay"
|
||||
[#]: author: "Alan Formy-Duval https://opensource.com/users/alanfdoss"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "unigeorge"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
使用 Linux cowsay 命令制作丰富多彩的节日问候
|
||||
======
|
||||
用这个有趣的 Linux 命令行工具来庆祝亡灵节吧。
|
||||
![Pumpkins painted for Day of the Dead][1]
|
||||
|
||||
你可能听说过这样一个小程序:它能接受输入信息(比如你通过键盘输入的消息),并输出一张引用了输入消息的牛的图像。这个小程序被称为 **cowsay**,之前已经在 [Opensource.com][2] 上介绍过了。
|
||||
|
||||
所以,为了搞点有趣的事,我想用它来庆祝<ruby>亡灵节<rt>Día de los Muertos</rt></ruby>(LCTT 译注:墨西哥传统的鬼节,著名动画电影《<ruby>寻梦环游记<rt>Coco</rt></ruby>》即以此为背景)。
|
||||
|
||||
除了牛之外,其实还有一些其他的可用图像。当安装 `cowsay` 时,程序会自动安装其他几个图像,并存储在 `/user/share/cowsay` 目录中。你可以用 `-l` 参数来获取图像列表。
|
||||
|
||||
```
|
||||
$ sudo dnf install cowsay
|
||||
$ cowsay -l
|
||||
```
|
||||
|
||||
实际上还有很多与 `cowsay` 或类似程序相关的开发活动。你可以创建自己的图像文件,也可以下载其他人制作的图像。例如,GitHub 上就有 [Charc0al 的 cowsay 文件转换器][3]。你可以用这一工具将自己的图片转换为 `cowsay` 所需的特殊 ASCII 格式文件。根据 Linux 或 FreeBSD 终端设置不同,您可能会启用颜色支持,而 `cowsay` 也可以显示彩色图像。Charc0al 的转换器也提供了许多现成的颜色文件。
|
||||
|
||||
我选择了“<ruby>甲壳虫汁<rt>Beetlejuice</rt></ruby>”(LCTT 译注:同名美国奇幻喜剧电影中的主角大法师)文件来开展我的“庆祝活动”。首先,我将 [beetlejuice.cow][4] 文件保存到了 `/usr/share/cowsay` 目录。这个目录权限属于 root 用户,你可以先将该文件保存到家目录,然后再复制过去。此外我们还需要将该文件的读取权限赋予所有用户。
|
||||
|
||||
```
|
||||
$ sudo cp beetlejuice.cow /usr/share/cowsay
|
||||
$ sudo chmod o+r /usr/share/cowsay/beetlejuice.cow
|
||||
```
|
||||
|
||||
关注一下图像是如何生成的(过程很有趣)。首先将各种 ASCII 颜色控制代码设置为变量,然后用这些变量,以传统的 ASCII 艺术风格绘制图像。生成的图像几乎是全身的,并且在不滚动屏幕的情况下,不适配我的终端的高度,所以我编辑了一下该文件,删除了最后 15 行以降低高度。
|
||||
|
||||
这个图像也可以被 `cowsay` 程序检测到,并展示在列表中。
|
||||
|
||||
```
|
||||
$ cowsay -l
|
||||
Cow files in /usr/share/cowsay:
|
||||
beavis.zen beetlejuice blowfish bud-frogs bunny cheese cower default dragon
|
||||
...
|
||||
```
|
||||
|
||||
现在,只要运行程序,并使用 `-f` 选项指定该图像就可以了。别忘了提供要输出的信息。
|
||||
|
||||
```
|
||||
$ cowsay -f beetlejuice "Happy Day of the Dead!"
|
||||
```
|
||||
|
||||
![ASCII display of Beetlejuice via cowsay][5]
|
||||
|
||||
“甲壳虫汁”祝你亡灵节快乐 (CC BY-SA 4.0)
|
||||
|
||||
`cowsay` 是 Linux 中一个有趣的搞怪小玩意。发挥你的创意,探索一下 `cowsay` 以及 ASCII 的艺术吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/11/linux-cowsay
|
||||
|
||||
作者:[Alan Formy-Duval][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/unigeorge)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/alanfdoss
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/drew-hays-unsplash.jpg?itok=uBrvJkTW (Pumpkins painted for Day of the Dead)
|
||||
[2]: https://opensource.com/article/18/12/linux-toy-cowsay
|
||||
[3]: https://charc0al.github.io/cowsay-files/converter/
|
||||
[4]: https://raw.githubusercontent.com/charc0al/cowsay-files/master/cows/beetlejuice.cow
|
||||
[5]: https://opensource.com/sites/default/files/cowsay_beetlejuice.png
|
Loading…
Reference in New Issue
Block a user