我正在bash中尝试以下mysql命令
#!/bin/bash
k=`echo SHOW COLUMNS FROM dsac000 \; | mysql -ulogin -ppw -A db`
echo $k
但我得到以下
Field Type Null Key Default Extra ID bigint(20) NO NULL DSAC0SEQU decimal(11,0) NO NULL DSAC0STAC varchar(3) YES NULL DSAC0N010 bigint(20) YES NULL DSAC0N011 varchar(50) YES NULL DSAC0N012 varchar(15) YES NULL DSAC0N013 int(11) YES NULL DSAC0N014 varchar(30) YES NULL DSAC0N015 varchar(26) YES NULL DSAC0A00N varchar(40) YES NULL DSAC0A00P varchar(60) YES NULL DSAC0DNAI date YES NULL DSAC0STAT varchar(3) YES NULL ....
通常我必须得到如下布局:
http://www.c-sharpcorner.com/UploadFile/65fc13/some-help-and-show-commands-in-mysql/Images/img-4.gif
我尝试添加--table
#!/bin/bash
k=`echo SHOW COLUMNS FROM dsac000 \; | mysql -ulogin -ppw --table -A db`
echo $k
但是输出仍然保持在一条线上
+-------------+---------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+---------------+------+-----+---------+----------------+ | ID | bigint(20) | NO | | NULL | | | DSAC0SEQU | decimal(11,0) | NO | | NULL | | | DSAC0STAC | varchar(3) | YES | | NULL | | | DSAC0N010 | bigint(20) | YES | | NULL | | | DSAC0N011 | varchar(50) | YES | | NULL | | | DSAC0N012 | varchar(15) | YES | | NULL | | | DSAC0N013 | int(11
谁能帮我解决这个问题?