diff --git a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md similarity index 62% rename from sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md rename to translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md index 9188914bbb..6d959d7339 100644 --- a/sources/tech/20181207 Plan your own holiday calendar at the Linux command line.md +++ b/translated/tech/20181207 Plan your own holiday calendar at the Linux command line.md @@ -7,18 +7,18 @@ [#]: via: (https://opensource.com/article/18/12/linux-toy-cal) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -Plan your own holiday calendar at the Linux command line +在 Linux 命令行中规划你的假期日历 ====== -Link commands together to build a colorful calendar, and then whisk it away in a snowstorm. +将命令链接在一起,构建一个彩色日历,然后在暴风雪中将其拂去。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cal.png?itok=S0F8RY9k) -Welcome to today's installment of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game or any simple diversion that helps you have fun at the terminal. +欢迎阅读今天推出的 Linux 命令行玩具降临日历。如果这是你第一次访问本系列,你可能会问:什么是命令行玩具。即使我不太确定,但一般来说,它可以是一个游戏或任何简单的娱乐,可以帮助你在终端玩得开心。 -It's quite possible that some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. +很可能你们中的一些人之前已经看过我们日历上的各种选择,但我们希望给每个人至少一件新东西。 -We've somehow made it to the seventh day of our series without creating an actual calendar to celebrate with, so let's use a command-line tool to do that today: **cal**. By itself, **cal** is perhaps not the most amazing of tools, but we can use a few other utilities to spice it up a bit. +我们在没有创建实际日历的情况下完成了本系列的第 7 天,所以今天让我们使用命令行工具来做到这一点:**cal**。就其本身而言,**cal** 可能不是最令人惊奇的工具,但我们可以使用其它一些实用程序来为它增添一些趣味。 -Chances are, **cal** is installed on your system already. To use it in this instance, just type **cal**. +很可能,你的系统上已经安装了 **cal**。要使用它,只需要输入 **cal** 即可。 ``` $ cal @@ -32,9 +32,10 @@ Su Mo Tu We Th Fr Sa 30 31           ``` -We aren't going to go into advanced usage in this article, so if you want to learn more about **cal** , go check out Opensource.com Community Moderator Don Watkin's excellent [overview of the date and cal commands][1]. +我们不打算在本文中深入介绍高级用法,因此如果你想了解有关 **cal** 的更多信息,查看 Opensouce.com 社区版主 Don Watkin 的优秀文章 [date 和 cal 命令概述][1]。 + +现在,让我们用一个漂亮的盒子来为它增添趣味,就像我们在上一篇 Linux 玩具文章中介绍的那样。我将使用钻石块,用一点内边距来对齐。 -Now, let's spice it up with a pretty box, as we covered in our previous Linux toy article. I'll use the diamonds box, and use a little bit of padding to get it nicely aligned. ``` $ cal | boxes -d diamonds -p a1l4t2  @@ -60,7 +61,7 @@ $ cal | boxes -d diamonds -p a1l4t2         \/          \/          \/ ``` -That looks nice, but for good measure, let's put the whole thing in a second box, just for fun. We'll use the scoll design this time. +看起来很不错,但是为了好的测量,让我们把整个东西放到另一个盒子里,为了好玩,这次我们将使用滚动设计。 ``` cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll         @@ -92,25 +93,25 @@ cal | boxes -d diamonds -p a1t2l3 | boxes -a c -d scroll            ~~~                                                ~~~ ``` -Perfect. Now, here's where things get a little crazy. I like our design, but, I'd like to go all out. So I'm going to colorize it. But here in the Raleigh, NC office where Opensource.com's staff are based, there's a good chance for snow this weekend. So let's enjoy our colorized advent calendar, and then wipe it out with snow. +完美。现在,事情变得有点疯狂了。我喜欢我们的设计,但我想全力以赴,所以我要给它上色。但是 Opensource.com 员工所在的北卡罗来版纳州罗利办公室,本周末很有可能下雪。所以,让我们享受彩色降临日历,然后用雪擦掉它。 -For the snow, I'm grabbing a nifty [snippet][2] of Bash and Gawk goodness I found over on CLIMagic. If you're not familiar with CLIMagic, go check out their [website][3] and follow them on [Twitter][4]. You'll be glad you did. +关于雪,我抓取了一些 Bash 和 Gawk 的漂亮[代码片段][2],幸亏我发现了 CLIMagic。如果你不熟悉 CLIMagic,去查看他们的[网站][3],在 [Twitter][4] 上关注他们。你会满意的。 -So here we go. Let's clear the screen, throw up our boxy calendar, colorize it, wait a few seconds, then snowstorm it away. All here at the terminal, in one line. +我们开始吧。让我们清除屏幕,扔掉四四方方的日历,给它上色,等几秒钟,然后用暴风雪把它吹走。这些在终端可以用一行命令完成。 ``` $ clear;cal|boxes -d diamonds -p a1t2l3|boxes -a c -d scroll|lolcat;sleep 3;while :;do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS)) $(printf "\u2744\n");sleep 0.1;done|gawk '{a[$3]=0;for(x in a) {o=a[x];a[x]=a[x]+1;printf "\033[%s;%sH ",o,x;printf "\033[%s;%sH%s \033[0;0H",a[x],x,$4;}}' ``` -And there we go. +大功告成。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-cal-animated.gif) -For this to work on your system, you'll need all of the referenced utilities (boxes, lolcat, cal, gawk, etc.), and you'll need to use a terminal emulator that supports Unicode. +要使它在你的系统上工作,你需要所有它引用的实用程序(box, lolcat, gawk 等),还需要使用支持 Unicode 的终端仿真器。 -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 -Check out yesterday's toy, [Take a break at the Linux command line with Nyan Cat][5], and check back tomorrow for another! +看看昨天的玩具:[使用 Nyan Cat 在 Linux 命令行休息][5]。记得明天再来! -------------------------------------------------------------------------------- @@ -118,7 +119,7 @@ via: https://opensource.com/article/18/12/linux-toy-cal 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[MjSeven](https://github.com/MjSeven) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出