首页 > 数据库技术 > 详细

mysql输出信息保留++--边框方法

时间:2014-08-13 19:14:08      阅读:355      评论:0      收藏:0      [点我收藏+]

我这方法是通过expect实现的。

安装expect

yum install -y expect


操作:

[root@ln-slave ~]# cat test.sh
/usr/local/mysql/bin/mysql -e "select version();"
[root@ln-slave ~]# ll test.sh
-rwxr-xr-x 1 root root 50 08-13 16:44 test.sh
[root@ln-slave ~]# sh test.sh
+------------+
| version()  |
+------------+
| 5.1.49-log |
+------------+
[root@ln-slave ~]# sh test.sh >a.txt  #直接这样是没有边框的。
[root@ln-slave ~]# cat a.txt
version()
5.1.49-log
[root@ln-slave ~]# cat mysql.exp  #通过expect实现
#!/usr/bin/expect -f
set timeout -1
spawn  ./test.sh
expect
[root@ln-slave ~]# expect mysql.exp >a.txt
[root@ln-slave ~]# cat a.txt
spawn ./test.sh  #多了这行,内容到手,删除即可。
+------------+
| version()  |
+------------+
| 5.1.49-log |
+------------+


本文出自 “Chocolee” 博客,请务必保留此出处http://chocolee.blog.51cto.com/8158455/1539586

mysql输出信息保留++--边框方法,布布扣,bubuko.com

mysql输出信息保留++--边框方法

原文:http://chocolee.blog.51cto.com/8158455/1539586

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!