我不確定這裏用/ usr/bin/mysql輸出的線條藝術在這裏發生了什麼。無法理解這種奇怪的MySql客戶端行爲
問題:我無法將藝術線條(用於創建表格列)重定向到文件!
首先,我在終端上這樣做。
[[email protected]:~/tmp]
$ mysql -usd sd -e 'select * from loan;'
+---------+--------------+--------+
| loan_no | branch_name | amount |
+---------+--------------+--------+
| L-11 | Round Hill | 900 |
| L-14 | Downtown | 1500 |
| L-15 | Perryridge | 1500 |
| L-16 | Perryridge | 1300 |
| L-17 | Downtown | 1000 |
| L-23 | Redwood | 2000 |
| L-93 | Mianus | 500 |
+---------+--------------+--------+
現在,我想上面拍攝的印這整個祝福的事情,所以我重定向輸出和錯誤的文件「出來」,像這樣:
[[email protected]:~/tmp]
$ mysql -usd sd -e 'select * from loan;' >out 2>&1
正如你可以看到下面的線藝術完全缺失!
[[email protected]:~/tmp]
$ cat out
loan_no branch_name amount
L-11 Round Hill 900
L-14 Downtown 1500
L-15 Perryridge 1500
L-16 Perryridge 1300
L-17 Downtown 1000
L-23 Redwood 2000
L-93 Mianus 500
更證明了藝術線條真的失蹤了! (-T選項打印選項卡,如果有的話)
[[email protected]:~/tmp]
$ cat -T out
loan_no^Ibranch_name^Iamount
L-11^IRound Hill^I900
L-14^IDowntown^I1500
L-15^IPerryridge^I1500
L-16^IPerryridge^I1300
L-17^IDowntown^I1000
L-23^IRedwood^I2000
L-93^IMianus^I500
所以,我的問題是,如何赫克用MySQL知道誰 - 無論是終端還是一個文本文件 - 吮吸它的輸出從'後端' :-)?
謝謝彼得。 爲您+1。 – Harry 2009-08-30 09:25:54