Linux/Unix 桌面趣事:文字模式下的 ASCII 艺术与注释绘画
boxes 命令不仅是一个文本过滤器,同时是一个很少人知道的有趣工具,它可以在输入的文本或者代码周围框上各种ASCII 艺术画。你可以用它快速创建邮件签名,或者在各种编程语言中留下评论块。这个命令可以在 vim 文本编辑器中使用,但是也可以在各种支持过滤器的文本编辑器中使用,同时也可以在命令行中单独使用。
任务: 安装 boxes
使用 apt-get 命令[1] 在 Debian / Ubuntu Linux 中安装 boxes:
$ sudoapt-get install boxes
输出示例:
Readingpackage 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 and6not upgraded.
Need to get0 B/59.8 kB of archives.
Afterthis 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 forman-db ...
Setting up boxes (1.0.1a-2.3)...
#yum install boxes
输出示例:
Loaded plugins: rhnplugin
Setting up InstallProcess
ResolvingDependencies
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
-->FinishedDependencyResolution
DependenciesResolved
==========================================================================
PackageArchVersionRepositorySize
==========================================================================
Installing:
boxes x86_64 1.1-8.el6 epel 64 k
TransactionSummary
==========================================================================
Install1Package(s)
Total download size:64 k
Installedsize:151 k
Isthis ok [y/N]: y
DownloadingPackages:
boxes-1.1-8.el6.x86_64.rpm |64 kB 00:00
Running rpm_check_debug
RunningTransactionTest
TransactionTestSucceeded
RunningTransaction
Installing: boxes-1.1-8.el6.x86_64 1/1
Installed:
boxes.x86_64 0:1.1-8.el6
Complete!
FreeBSD 用户可以按如下使用:
cd/usr/ports/misc/boxes/&&make install clean
或者,使用 pkg_add 命令来增加包:
# pkg_add -r boxes
在一些给定文本周围画出任何种类的包围框
输入下列命令:
echo"This is a test"| boxes
或者,指定要使用的图案的名字:
echo-e "\n\tVivek Gite\n\[email protected]\n\twww.cyberciti.biz"| boxes -d dog
输出示例 :
Unix / Linux: Boxes Command To Draw Various Designs
*图01: Unix / Linux: Boxes 命令来画出各式各样的图案 *
怎么样输出所有的图案
语法如下:
boxes option
pipe | boxes options
echo"text"| boxes -d foo
boxes -l
-d 选项用来设置要使用的图案的名字。语法如下:
echo"Text"| boxes -d design
pipe | boxes -d desig
-l 选项列出所有图案。它显示了在配置文件中的所有的框线设计图,同时也显示关于其创作者的信息。
boxes -l
boxes -l |more
boxes -l |less
输出示例:
43AvailableStylesin"/etc/boxes/boxes-config":
-------------------------------------------------
ada-box (NeilBird):
---------------
----
----
---------------
ada-cmt (NeilBird):
--
-- regular Ada
-- comments
--
boy (Joan G.Stark):
.-"""-.
/ .===. \
\/ 6 6 \/
( \___/ )
_________ooo__\_____/______________
/ \
| joan stark [email protected] |
| VISIT MY ASCII ART GALLERY: |
| http://www.geocities.com/SoHo/7373/ |
\_______________________ooo_________/ jgs
| | |
|_ | _|
| | |
|__|__|
/-'Y'-\
(__/ \__)
....
...
output truncated
..
在使用 vi/vim 文本编辑器时如何通过 boxes 过滤文本?
你可以在 vi 或 vim 中使用任何外部命令,比如在这个例子中,插入当前日期和时间[4],输入:
!!date
或者
:r !date
你需要在 vim 中输入以上命令来读取 date 命令的输出,这将在当前行后面加入日期和时分秒:
TueJun1200:05:38 IST 2012
你可以用 boxes 命令做到同样的功能。如下创建一个作为示例的 shell 脚本或者c程序:
#!/bin/bash
Purpose:Backup mysql database to remote server.
Author:VivekGite
Last updated on:TueJun,122012
现在输入如下(将光标移到第二行,也就是以“Purpose: ...”开头的行)
3!!boxes
瞧,你就会看到如下的输出 :
#!/bin/bash
/****************************************************/
/* Purpose: Backup mysql database to remote server. */
/* Author: Vivek Gite */
/* Last updated on: Tue Jun, 12 2012 */
/****************************************************/
这个短片将会给你介绍boxes命令:
此处应有视频,地址: https://dn-linuxcn.qbox.me/static/video/Text%20mode%20box%20and%20comment%20drawing%20filter%20for%20vim%20_%20_nix%20command%20line-glzXjNvrYOc.mp4
参见
- boxes 帮助手册
[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/
[4]: http://www.cyberciti.biz/faq/vim-inserting-current-date-time-under-linux-unix-osx/
[5]: https://github.com/zky001
[6]: https://github.com/wxy
[7]: https://github.com/LCTT/TranslateProject
[8]: https://linux.cn/article-7401-1.html?wx
推荐文章
点击标题或输入文章 ID 直达该文章 |
---|
3436 Java 工程师成神之路 |
3460 Linux/Unix 桌面趣事:蒸汽火车 |
将文章分享给朋友是对我们最好的赞赏!
阅读原文 最新评论
推荐文章
作者最新文章
你可能感兴趣的文章
Copyright Disclaimer: The copyright of contents (including texts, images, videos and audios) posted above belong to the User who shared or the third-party website which the User shared from. If you found your copyright have been infringed, please send a DMCA takedown notice to [email protected]. For more detail of the source, please click on the button "Read Original Post" below. For other communications, please send to [email protected].
版权声明:以上内容为用户推荐收藏至CareerEngine平台,其内容(含文字、图片、视频、音频等)及知识版权均属用户或用户转发自的第三方网站,如涉嫌侵权,请通知[email protected]进行信息删除。如需查看信息来源,请点击“查看原文”。如需洽谈其它事宜,请联系[email protected]。
版权声明:以上内容为用户推荐收藏至CareerEngine平台,其内容(含文字、图片、视频、音频等)及知识版权均属用户或用户转发自的第三方网站,如涉嫌侵权,请通知[email protected]进行信息删除。如需查看信息来源,请点击“查看原文”。如需洽谈其它事宜,请联系[email protected]。