Estoy compilando comandos mysql en un script perl y quiero usar la opción -tee para obtener un archivo que muestre lo que sucedió.
Entonces, aquí abajo, estoy haciendo el mismo comando. En el primero, está dentro de un script en perl. En el segundo, está en la línea de comandos. En ambos casos, se crea el archivo tee, pero cuando lo llamo a través de perl, está vacío. ¿Que demonios? :--)
% % cat test1.pl #!/usr/bin/perl open M, "| mysql --tee=x1.txt ca_sos_20200615"; print M "select count(8) from filer_filings;\n"; close M; % ./test1.pl Logging to file 'x1.txt' count(8) 2273504 % % mysql --tee=x2.txt ca_sos_20200615 Logging to file 'x2.txt' Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 353 Server version: 8.0.19 MySQL Community Server - GPL Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select count(8) from filer_filings; +----------+ | count(8) | +----------+ | 2273504 | +----------+ 1 row in set (0.18 sec) mysql> quit Bye % % ls -l x1.txt x2.txt -rw-r--r-- 1 ray staff 0 Jul 4 14:24 x1.txt -rw-r--r-- 1 ray staff 714 Jul 4 14:24 x2.txt %