Say when I run mysql -u user -p -e 'select id from db.users limit 1'
, I got:
+------+
| id |
+------+
| 8434 |
+------+
When I redirect the output/stdout to some file, like mysql -u user -p -e 'select id from db.users limit 1' > /tmp/a.txt
, then I cat /tmp/a.txt
, I got:
id
8434
So where do those little format strings go? Does it mean that mysql
knows when it is redirected, so it returns a different format? I always thought a redirect(>
) doesn't concern the previous command, that it doesn't have to know if or where its output is redirected. Or is it another explanation?