I'd like to execute a SQL script file from mysql command line tool, like
mysql database < script.sql
where the script script.sql contains a statement that redirects the output to a file.
I thought this should be possible by placing a tee into the script like this:
tee script.log;
SELECT sysdate() AS "Start" FROM dual;
UPDATE table SET column = 'off';
COMMIT;
Unfortunately, this does not work, no script.log appears.
Is there any possibility to redirect the output to a file from the script itself?
Use case: These scripts will be executed by our Service Department when deploying the application. They would like to execute the script with as little steps and effort as possible, so placing a redirect (> script.log) at the end of the command prompt is not a real option, at least if they must execute a bunch of scripts at once.
Thanks in advance, Michael