$ mysql -e 'select a,b from tablefoo' databasename
+---+---+ | a | b | +---+---+ | 1 | 0 | | 2 | 1 | +---+---+
$ mysql -e 'select a,b from tablefoo' databasename > file
yields a file
a b 1 0 2 1
(where a tab is between the alphanumeric characters on each line).
I'd think that redirection shouldn't change the output. Why do I get two different results?
Edit: William Jackson's answer says that this is a feature of mysql: output format depends on whether the output is being redirected. This doesn't answer my question, though. How does mysql 'know' whether output is being redirected? Does redirection not just take the output and, well, redirect it somewhere? Shouldn't that be invisible to mysql?