撒的阿坎努斯 发表于 2018-9-30 06:55:37

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

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

页: [1]
查看完整版本: mysql输出信息保留++--边框方法