понеділок, 10 грудня 2012 р.

Handly shell programming using MySQL

A very handy options to use MySQL queries results in your shell scripts:

       ·   --batch, -B
           Print results using tab as the column separator, with each row on a
           new line. With this option, mysql does not use the history file.

           Batch mode results in nontabular output format and escaping of
           special characters. Escaping may be disabled by using raw mode; see
           the description for the --raw option.

       ·   --skip-column-names, -N
           Do not write column names in results.

Feel the difference!
> mysql -h localhost -e 'show status like "uptime"'
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Uptime        | 2612  |
+---------------+-------+

> mysql -h localhost  -B -N -e 'show status like "uptime"'
Uptime 2619

Refrerences:

Немає коментарів:

Дописати коментар