2016-02-18 17:01:56 +08:00
|
|
|
|
|
|
|
|
|
Linux / Unix 桌面娱乐 :
|
|
|
|
|
文字模式的带有ASCII艺术的Box与评论绘制
|
|
|
|
|
|
2015-12-15 10:46:54 +08:00
|
|
|
|
================================================================================
|
2016-02-18 17:01:56 +08:00
|
|
|
|
Boxes 命令不仅是一个文本过滤器,同时是一个很少人知道的可以为了乐趣或者需要在它的输入文本或者代码周围画各种ASCII艺术画的工具。你可以迅速创建邮件签名,或者使用各种编程语言创建局部评论。这个命令计划被vim文本编辑器使用,但是也可以被支持过滤的文本编辑器使用,同时从命令行作为一个单独的工具使用。
|
|
|
|
|
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
### 任务: 安装 boxes ###
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
使用 [apt-get command][1] 在 Debian / Ubuntu Linux中安装 boxes :
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
$ sudo apt-get install boxes
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
输出示例 :
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
Reading package lists... Done
|
|
|
|
|
Building dependency tree
|
|
|
|
|
Reading state information... Done
|
|
|
|
|
The following NEW packages will be installed:
|
|
|
|
|
boxes
|
|
|
|
|
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
|
|
|
|
|
Need to get 0 B/59.8 kB of archives.
|
|
|
|
|
After this operation, 205 kB of additional disk space will be used.
|
|
|
|
|
Selecting previously deselected package boxes.
|
|
|
|
|
(Reading database ... 224284 files and directories currently installed.)
|
|
|
|
|
Unpacking boxes (from .../boxes_1.0.1a-2.3_amd64.deb) ...
|
|
|
|
|
Processing triggers for man-db ...
|
|
|
|
|
Setting up boxes (1.0.1a-2.3) ...
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
RHEL / CentOS / Fedora Linux 用户, 使用 [yum command to install boxes][2] (首先 [enable EPEL repo as described here][3]):
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
# yum install boxes
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
输出示例 :
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
Loaded plugins: rhnplugin
|
|
|
|
|
Setting up Install Process
|
|
|
|
|
Resolving Dependencies
|
|
|
|
|
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
|
|
|
|
|
--> Running transaction check
|
|
|
|
|
---> Package boxes.x86_64 0:1.1-8.el6 will be installed
|
|
|
|
|
--> Finished Dependency Resolution
|
|
|
|
|
Dependencies Resolved
|
|
|
|
|
==========================================================================
|
|
|
|
|
Package Arch Version Repository Size
|
|
|
|
|
==========================================================================
|
|
|
|
|
Installing:
|
|
|
|
|
boxes x86_64 1.1-8.el6 epel 64 k
|
|
|
|
|
Transaction Summary
|
|
|
|
|
==========================================================================
|
|
|
|
|
Install 1 Package(s)
|
|
|
|
|
Total download size: 64 k
|
|
|
|
|
Installed size: 151 k
|
|
|
|
|
Is this ok [y/N]: y
|
|
|
|
|
Downloading Packages:
|
|
|
|
|
boxes-1.1-8.el6.x86_64.rpm | 64 kB 00:00
|
|
|
|
|
Running rpm_check_debug
|
|
|
|
|
Running Transaction Test
|
|
|
|
|
Transaction Test Succeeded
|
|
|
|
|
Running Transaction
|
|
|
|
|
Installing : boxes-1.1-8.el6.x86_64 1/1
|
|
|
|
|
Installed:
|
|
|
|
|
boxes.x86_64 0:1.1-8.el6
|
|
|
|
|
Complete!
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
FreeBSD 用户可以按如下来使用 :
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
cd /usr/ports/misc/boxes/ && make install clean
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
或者,使用 pkg_add 命令来增加包:
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
# pkg_add -r boxes
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
### 在一些给定文本周围画出任何种类的box ###
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
输入下列命令 :
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
echo "This is a test" | boxes
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
或者,通过设置要使用的设计的名字来使用 :
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
echo -e "\n\tVivek Gite\n\tvivek@nixcraft.com\n\twww.cyberciti.biz" | boxes -d dog
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
输出示例 :
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
![Unix / Linux: Boxes Command To Draw Various Designs](http://s0.cyberciti.org/uploads/l/tips/2012/06/unix-linux-boxes-draw-dog-design.png)
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
Fig.01: Unix / Linux: Boxes 命令来画出各式各样的设计
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
#### 怎么样输出所有的设计 ####
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
语法如下:
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
boxes option
|
|
|
|
|
pipe | boxes options
|
|
|
|
|
echo "text" | boxes -d foo
|
|
|
|
|
boxes -l
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
设计 -d 选项设置要使用的设计的名字 . 语法如下:
|
|
|
|
|
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
echo "Text" | boxes -d design
|
|
|
|
|
pipe | boxes -d desig
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
-l 选项列出所有设计 . 它显示在配置文件中的所有的box设计图,同时也显示关于其创作者的信息。
|
|
|
|
|
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
boxes -l
|
|
|
|
|
boxes -l | more
|
|
|
|
|
boxes -l | less
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
输出示例:
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
43 Available Styles in "/etc/boxes/boxes-config":
|
|
|
|
|
-------------------------------------------------
|
|
|
|
|
ada-box (Neil Bird ):
|
|
|
|
|
---------------
|
|
|
|
|
-- --
|
|
|
|
|
-- --
|
|
|
|
|
---------------
|
|
|
|
|
ada-cmt (Neil Bird ):
|
|
|
|
|
--
|
|
|
|
|
-- regular Ada
|
|
|
|
|
-- comments
|
|
|
|
|
--
|
|
|
|
|
boy (Joan G. Stark ):
|
|
|
|
|
.-"""-.
|
|
|
|
|
/ .===. \
|
|
|
|
|
\/ 6 6 \/
|
|
|
|
|
( \___/ )
|
|
|
|
|
_________ooo__\_____/______________
|
|
|
|
|
/ \
|
|
|
|
|
| joan stark spunk1111@juno.com |
|
|
|
|
|
| VISIT MY ASCII ART GALLERY: |
|
|
|
|
|
| http://www.geocities.com/SoHo/7373/ |
|
|
|
|
|
\_______________________ooo_________/ jgs
|
|
|
|
|
| | |
|
|
|
|
|
|_ | _|
|
|
|
|
|
| | |
|
|
|
|
|
|__|__|
|
|
|
|
|
/-'Y'-\
|
|
|
|
|
(__/ \__)
|
|
|
|
|
....
|
|
|
|
|
...
|
|
|
|
|
output truncated
|
|
|
|
|
..
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
### 在使用vi/vim文本编辑器时如何通过boxes过滤文本? ###
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
你可以使用vi或vim支持的任何附加命令,在这个例子中, [insert current date and time][4], 输入:
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
!!date
|
|
|
|
|
|
2016-02-17 10:31:36 +08:00
|
|
|
|
或者
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
:r !date
|
2016-02-18 17:01:56 +08:00
|
|
|
|
你需要在vim中输入以上命令来读取数据命令的输出,这将在当前行后面加入日期和时分秒:
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
Tue Jun 12 00:05:38 IST 2012
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
你可以用boxes命令做到同样的. 创建一个作为样本的shell脚本或者如下的一个c程序:
|
|
|
|
|
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
Purpose: Backup mysql database to remote server.
|
|
|
|
|
Author: Vivek Gite
|
|
|
|
|
Last updated on: Tue Jun, 12 2012
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
现在输入如下 (将光标移到第二行,也就是以"Purpose: ..."开头的行)
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
3!!boxes
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
瞧,你就会看到如下的输出 :
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
/****************************************************/
|
|
|
|
|
/* Purpose: Backup mysql database to remote server. */
|
|
|
|
|
/* Author: Vivek Gite */
|
|
|
|
|
/* Last updated on: Tue Jun, 12 2012 */
|
|
|
|
|
/****************************************************/
|
2016-02-18 17:01:56 +08:00
|
|
|
|
这个短片将会给你介绍boxes命令:
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
注:youtube 视频
|
|
|
|
|
<iframe width="595" height="446" frameborder="0" src="http://www.youtube.com/embed/glzXjNvrYOc?rel=0"></iframe>
|
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
(Video:01: boxes command in action. BTW, this is my first video so go easy on me and let me know what you think.)
|
|
|
|
|
|
|
|
|
|
另见
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
2016-02-18 17:01:56 +08:00
|
|
|
|
- boxes man 手册
|
2015-12-15 10:46:54 +08:00
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
via: http://www.cyberciti.biz/tips/unix-linux-draw-any-kind-of-boxes-around-text-editor.html
|
|
|
|
|
|
|
|
|
|
作者:Vivek Gite
|
2016-02-18 17:01:56 +08:00
|
|
|
|
译者:[zky001](https://github.com/zky001)
|
2015-12-15 10:46:54 +08:00
|
|
|
|
校对:[校对者ID](https://github.com/校对者ID)
|
|
|
|
|
|
|
|
|
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
|
|
|
|
|
|
|
|
[1]:http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html
|
|
|
|
|
[2]:http://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/
|
|
|
|
|
[3]:http://www.cyberciti.biz/faq/fedora-sl-centos-redhat6-enable-epel-repo/
|
2016-01-01 20:15:17 +08:00
|
|
|
|
[4]:http://www.cyberciti.biz/faq/vim-inserting-current-date-time-under-linux-unix-osx/
|